-
Notifications
You must be signed in to change notification settings - Fork 517
/
Makefile
105 lines (89 loc) · 2.78 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
.PHONY: help
.DEFAULT_GOAL := help
NAME := gitlist
VERSION := $(shell git show -s --format=%h)
EXEC_DOCKER ?= docker-compose exec -T
EXEC_PHP ?= $(EXEC_DOCKER) php-fpm
EXEC_NODE ?= $(EXEC_DOCKER) node
EXEC_WEB ?= $(EXEC_DOCKER) web
help: # Display the application manual
@echo -e "$(NAME) version \033[33m$(VERSION)\n\e[0m"
@echo -e "\033[1;37mUSAGE\e[0m"
@echo -e " \e[4mmake\e[0m <command> [<arg1>] ... [<argN>]\n"
@echo -e "\033[1;37mAVAILABLE COMMANDS\e[0m"
@grep -E '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?# "}; {printf " \033[32m%-20s\033[0m %s\n", $$1, $$2}'
check-deps: check-local-overrides
@if ! [ -x "$$(command -v docker-compose)" ]; then\
echo -e '\n\033[0;31mdocker-compose is not installed.';\
exit 1;\
else\
echo -e "\033[0;32mdocker-compose installed\033[0m";\
fi
setup: check-deps # Setup dependencies and development configuration
@docker-compose pull || true
@docker-compose up -d --build
$(EXEC_PHP) composer install
up: # Create and start containers
@docker-compose up -d
clean: # Cleanup containers and build artifacts
@docker-compose down
$(MAKE) setup
bash: # Start a bash session in the PHP container
@docker-compose exec php-fpm /bin/bash
test: # Run automated test suite
$(EXEC_PHP) composer test
$(EXEC_NODE) npm run test
acceptance:# Run acceptance test suite
$(EXEC_NODE) npm run cypress
show-app: # Open applicatipn in your browser
xdg-open http://$$(docker-compose port webserver 80)/
update: # Update dependencies
$(EXEC_PHP) composer update
format: # Run code style autoformatter
$(EXEC_PHP) composer format
build: # Build application package
@rm -rf vendor/
@rm -rf public/assets/*
@composer install --ignore-platform-reqs --no-dev --no-scripts -o
@npm run build
@zip ./build.zip \
-r * .[^.]* \
-x '.github/*' \
-x 'bin/*' \
-x 'docker/*' \
-x 'node_modules/*' \
-x 'tests/' \
-x 'var/cache/*' \
-x 'var/log/*' \
-x '.dockerignore' \
-x '.editorconfig' \
-x '.env' \
-x '.env.dist' \
-x '.git/*' \
-x '.gitignore' \
-x '.php-cs-fixer.cache' \
-x '.php-cs-fixer.php' \
-x '.phpunit.result.cache' \
-x '.prettierrc' \
-x 'composer.json' \
-x 'composer.lock' \
-x 'docker-compose.override.yml' \
-x 'docker-compose.override.yml.dist' \
-x 'docker-compose.yml' \
-x 'Makefile' \
-x 'package-lock.json' \
-x 'package.json' \
-x 'phpstan.neon' \
-x 'phpunit.xml.dist' \
-x 'postcss.config.js' \
-x 'webpack.config.js' \
fix-perms:
sudo setfacl -R -m u:root:rwX -m u:`whoami`:rwX var/cache var/log vendor/
sudo setfacl -dR -m u:root:rwx -m u:`whoami`:rwx var/cache var/log vendor/
check-local-overrides:
@$(MAKE) --quiet .env
@$(MAKE) --quiet docker-compose.override.yml
docker-compose.override.yml:
@ln -s --backup=none docker-compose.override.yml.dist $@
.env:
@ln -s --backup=none .env.dist $@