-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
109 lines (82 loc) · 3.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
106
107
108
109
.DEFAULT_GOAL := help
CURRENT_DIR := $(shell pwd)
DOCKER_COMPOSE=docker-compose
PHP_RUN=$(DOCKER_COMPOSE) run --rm -u www-data php php
CURRENT_USER_ID=$(shell id -u)
CURRENT_GROUP_ID=$(shell id -g)
.PHONY: help
help:
@echo ""
@echo "Badger available targets: "
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
####################################################### Docker #####################################################
.PHONY: start
start: ## Start the project
$(DOCKER_COMPOSE) up -d ${C}
.PHONY: stop
stop: ## Stop the project
$(DOCKER_COMPOSE) stop
.PHONY: down
down: ## Down the project
$(DOCKER_COMPOSE) down -v
.PHONY: php-image-dev
php-image-dev: ## Build the dev docker image
DOCKER_BUILDKIT=1 docker build --build-arg USER_ID=$(CURRENT_USER_ID) --build-arg USER_GROUP=$(CURRENT_GROUP_ID) --progress=plain --pull --tag badger/dev/php:7.4 --target dev ./infrastructure
.PHONY: php-image-dev-mac
php-image-dev-mac:
DOCKER_BUILDKIT=1 docker image build --progress=plain --pull --tag badger/dev/php:7.4 --target dev ./infrastructure
.PHONY: php-image-prod
php-image-prod: ## Build the prod docker image
DOCKER_BUILDKIT=1 docker build --progress=plain --pull --tag badger/prod:${IMAGE_TAG} --target prod ./infrastructure
.PHONY: php-images ## Build all docker image
php-images: php-image-dev php-image-prod
################################################# Install ##############################################################
application/composer.lock: application/composer.json
$(PHP_RUN) /usr/local/bin/composer update
application/vendor: application/composer.lock
$(PHP_RUN) /usr/local/bin/composer install
.PHONY: cache
cache: ## Remove the cache
rm -rf var/cache && $(PHP_RUN) bin/console cache:warmup
.PHONY: sf
sf: ## Call the symfony console
$(PHP_RUN) bin/console ${F}
.PHONY: app-dev
app-dev: application/vendor
APP_ENV=dev $(MAKE) start
APP_ENV=dev $(MAKE) cache
.PHONY: db-schema
db-schema:
$(PHP_RUN) bin/console d:s:u --dump-sql
$(PHP_RUN) bin/console d:s:u --force
##################################################### Gamification #####################################################
.PHONY: gamification-phpstan
gamification-phpstan:
$(PHP_RUN) vendor/bin/phpstan analyse src/Gamification --level=7 -c config/tests/gamification/phpstan.neon
.PHONY: gamification-cs
gamification-cs: ## Run Gamification Coding Style fixer
$(PHP_RUN) vendor/bin/php-cs-fixer fix --config=config/tests/gamification/.php_cs --diff
.PHONY: gamification-back-static
gamification-back-static: gamification-phpstan gamification-cs
.PHONY: gamification-phpspec
gamification-phpspec: ## Run Gamification PHPSpec
$(PHP_RUN) vendor/bin/phpspec run --config config/tests/gamification/phpspec.yml
.PHONY: gamification-phpspec-desc
gamification-phpspec-desc: ## Run Gamification PHPSpec describe
$(PHP_RUN) vendor/bin/phpspec describe --config config/tests/gamification/phpspec.yml
.PHONY: gamification-acceptance
gamification-acceptance: ## Run Gamification acceptance tests
$(PHP_RUN) vendor/bin/behat -p gamification_acceptance -f progress -c config/tests/gamification/behat.yml
.PHONY: gamification-end-to-end-api
gamification-end-to-end-api: ## Run Gamification end to end tests
$(PHP_RUN) vendor/bin/behat -p gamification_end_to_end_api -f progress -c config/tests/gamification/behat.yml
.PHONY: gamification-back
gamification-back: gamification-back-static gamification-phpspec gamification-acceptance gamification-end-to-end-api
.PHONY: gamification-tests ## Run all the gamification tests
gamification-tests: gamification-back
.PHONY: init-db
init-db:
$(PHP_RUN) bin/console doctrine:database:drop --force
$(PHP_RUN) bin/console doctrine:database:create
$(PHP_RUN) bin/console doctrine:schema:update --force