-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
129 lines (92 loc) · 4.93 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
containerName = "simplecv-creator-cv-app-1"
isContainerRunning := $(shell docker info > /dev/null 2>&1 && docker ps | grep $(containerName) > /dev/null 2>&1 && echo 1)
user := $(shell id -u)
group := $(shell id -g)
DOCKER :=
DOCKER_COMPOSE := USER_ID=$(user) GROUP_ID=$(group) docker compose
DOCKER_TEST := APP_ENV=testing
CONSOLE := $(DOCKER) php artisan
CONSOLE_MEMORY := $(DOCKER) php -d memory_limit=256M
CONSOLE_TEST := $(DOCKER_TEST) php
COMPOSER = $(DOCKER) composer
SAIL = vendor/bin/sail
ifeq ($(isContainerRunning), 1)
DOCKER := @docker exec -t -u $(user):$(group) $(containerName) php
DOCKER_COMPOSE := USER_ID=$(user) GROUP_ID=$(group) docker compose
DOCKER_TEST := @docker exec -t -u $(user):$(group) $(containerName) APP_ENV=testing php
endif
## —— App ————————————————————————————————————————————————————————————————
build-docker:
$(DOCKER_COMPOSE) pull --ignore-pull-failures
$(DOCKER_COMPOSE) build --no-cache
up:
sh vendor/bin/sail up -d
up-prod:
sh vendor/bin/sail -f docker-compose.yml -f docker-compose.prod.yml up -d
stop:
sh vendor/bin/sail stop
down:
sh vendor/bin/sail down
prune:
@docker-compose down --remove-orphans
@docker-compose down --volumes
@docker-compose rm -f
serve:
$(CONSOLE) serve
install-project: install reset-database generate-jwt ## First installation for setup the project
update-project: install reset-database ## update the project after a checkout on another branch or to reset the state of the project
sync: update-project test-all ## Synchronize the project with the current branch, install composer dependencies, drop DB and run all migrations, fixtures and all test
## —— 🐝 The Symfony Makefile 🐝 ———————————————————————————————————
help: ## Outputs this help screen
@grep -E '(^[a-zA-Z0-9_-]+:.*?## .*$$)|(^## )' Makefile | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
## —— Composer 🧙♂️ ————————————————————————————————————————————————————————————
install: composer.lock ## Install vendors according to the current composer.lock file
$(COMPOSER) install -n
update: composer.json ## Update vendors according to the composer.json file
$(COMPOSER) update -w
## —— Symfony ————————————————————————————————————————————————————————————————
cc: ## Apply cache clear
$(CONSOLE) cache:clear
cc-test: ## Apply cache clear
$(CONSOLE_TEST) cache:clear
cc-config:
$(CONSOLE) config:clear
cc-view:
$(CONSOLE) view:clear
optimize:
$(CONSOLE) optimize:clear
cc-all: cc cc-config cc-view optimize ## Apply cache clear
doctrine-validate:
$(CONSOLE) doctrine:schema:validate --skip-sync $c
reset-database: migrate ## Reset database with migration
database: ## Create database if no exists
$(CONSOLE) migrate:status
drop-database: ## Drop the database
$(CONSOLE) doctrine:database:drop --force --if-exists
migration: ## Apply doctrine migration
$(CONSOLE) make:migration $c
migrate: ## Apply doctrine migrate
$(CONSOLE) migrate:fresh
generate-jwt: ## Generate private and public keys
$(CONSOLE) lexik:jwt:generate-keypair --overwrite -q $c
## —— Integration ✅ ——————————————————————————————————————————————————————
load-fixtures: migrate ## Load fixtures
$(CONSOLE) db:seed --class=ExperienceTypeSeeder
$(CONSOLE) db:seed --class=SkillTypeSeeder
## —— Tests ✅ ————————————————————————————————————————————————————————————
test-database: ### load database schema
$(CONSOLE_TEST) artisan migrate:fresh --seed
test-load-fixtures: test-database ## load database schema & fixtures
$(CONSOLE_TEST) db:seed --class=ExperienceTypeSeeder
$(CONSOLE_TEST) db:seed --class=SkillTypeSeeder
pest:
$(SAIL) bin pest
test: phpunit.xml* ## Launch main functional and unit tests, stopped on failure
$(SAIL) ./vendor/bin/pest --stop-on-failure $c
test-all: phpunit.xml* test-load-fixtures ## Launch main functional and unit tests
$(DOCKER_TEST) ./vendor/bin/pest
test-report: phpunit.xml* test-load-fixtures ## Launch main functional and unit tests with report
$(DOCKER_TEST) ./vendor/bin/pest --coverage-text --colors=never --log-junit report.xml $c
## —— Coding standards ✨ ——————————————————————————————————————————————————————
pint: ## Run ECS only
$(SAIL) bin pint