11default : help
22
33# Variables
4- CURRENT_UID ?= $(shell id -u)
5- DOCKER_UP_OPTIONS ?=
64DOCKER_COMPOSE_BIN ?= docker compose
75
86# Colors
@@ -13,9 +11,8 @@ TEXT_BOLD = \033[1m
1311
1412# #@ Setup 📜
1513# ## Installer le projet from scratch
16- install :
17- cp -n .env.dist .env && cp -n docker.env docker.env.local && cp -n ./docker/data/history.dist ./docker/data/history && cp -n compose.override.yml-dist compose.override.yml
18- mkdir -p ./htdocs/uploads -p ./tmp
14+ install : init-file init-folder
15+ cp -n ./docker/data/history.dist ./docker/data/history && cp -n compose.override.yml-dist compose.override.yml
1916
2017 $(DOCKER_COMPOSE_BIN) up -d --build
2118
@@ -26,7 +23,7 @@ install:
2623 $(MAKE) --no-print-directory build-assets
2724
2825 # Reset la base de donnée
29- cat ./. docker/mysql/reset-db.sql | $(DOCKER_COMPOSE_BIN) run -T --rm db /opt/mysql_no_db
26+ cat ./docker/mysql/reset-db.sql | $(DOCKER_COMPOSE_BIN) run -T --rm db /opt/mysql_no_db
3027
3128 $(DOCKER_COMPOSE_BIN) exec --user localUser apachephp php bin/phinx migrate
3229 $(DOCKER_COMPOSE_BIN) exec --user localUser apachephp php bin/phinx seed:run
@@ -35,7 +32,7 @@ install:
3532reset :
3633 $(DOCKER_COMPOSE_BIN ) down --remove-orphans -v
3734 rm -f ./.env -f ./docker.env.local -f ./docker/data/history -f compose.override.yml
38- sudo rm -rf ./var ./vendor ./node_modules ./htdocs/bundles ./htdocs/docs ./htdocs/uploads ./htdocs/assets ./tmp
35+ sudo rm -rf ./var/cache/dev ./var/cache/prod ./var/cache/test ./var/logs/ * .log ./vendor ./node_modules ./htdocs/bundles ./htdocs/docs ./htdocs/uploads ./htdocs/assets ./tmp
3936
4037# ## Reinstalle le projet from scratch
4138reinstall : reset install
@@ -54,24 +51,20 @@ watch-assets:
5451 $(DOCKER_COMPOSE_BIN ) run --rm node npm run watch
5552
5653# #@ Quality ✨
57- # ## Installe l'environment de test
58- install-test :
59- mkdir -p ./htdocs/uploads -p ./tmp
60-
6154# ## Lance toute la suite de tests
6255tests : cs-lint unit-test test-integration behat
6356
6457# ## Lance les tests unitaire
6558unit-test :
66- $(DOCKER_COMPOSE_BIN ) exec --user localUser apachephptest ./bin/phpunit --testsuite unit
59+ $(DOCKER_COMPOSE_BIN ) exec --user localUser apachephp ./bin/phpunit --testsuite unit
6760
6861# ## Tests d'intégration
6962test-integration : # not work
70- $(DOCKER_COMPOSE_BIN ) exec --user localUser apachephptest ./bin/phpunit --testsuite integration
63+ $(DOCKER_COMPOSE_BIN ) exec --user localUser apachephp ./bin/phpunit --testsuite integration
7164
7265# ## Tests fonctionnels
7366behat :
74- $(DOCKER_COMPOSE_BIN ) exec --user localUser apachephptest ./bin/behat
67+ $(DOCKER_COMPOSE_BIN ) exec --user localUser apachephp ./bin/behat
7568
7669# ## PHP CS Fixer (dry run)
7770cs-lint :
@@ -108,7 +101,7 @@ test-integration-ci:
108101
109102# ## Analyse PHPStan
110103phpstan :
111- docker run -v $( shell pwd) :/app --rm ghcr.io/phpstan /phpstan
104+ $( DOCKER_COMPOSE_BIN ) exec -u localUser apachephp ./bin /phpstan --memory-limit=-1
112105
113106# #@ Docker 🐳
114107# ## Démarrer un bash dans le container PHP
@@ -139,9 +132,12 @@ help:
139132.PHONY : install tests hooks console phpstan help
140133.SILENT : help
141134
135+ # # Target only used by other make command
136+ # Used by "rector" target
142137var/cache/dev/AppKernelDevDebugContainer.xml :
143138 $(DOCKER_COMPOSE_BIN ) exec --user localUser apachephp bin/console cache:warmup --env=dev
144139
140+ # Used by "hooks" target
145141pre-commit :
146142 echo " #!/bin/sh" > .git/hooks/pre-commit
147143 echo " docker compose run --rm -u localUser apachephp make test" >> .git/hooks/pre-commit
@@ -151,3 +147,11 @@ post-checkout:
151147 echo " #!/bin/sh" > .git/hooks/post-checkout
152148 echo " docker compose run --rm -u localUser apachephp composer install --no-scripts" >> .git/hooks/post-checkout
153149 chmod +x .git/hooks/post-checkout
150+
151+ # Used by CI and "install" target
152+ init-file :
153+ cp -n .env.dist .env && cp -n docker.env docker.env.local
154+
155+ # Used by CI and "install" target
156+ init-folder :
157+ mkdir -p ./htdocs/uploads -p ./tmp
0 commit comments