This repository has been archived by the owner on Nov 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
171 lines (140 loc) · 3.99 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
.SILENT:
.PHONY: build test
## Colors
COLOR_RESET = \033[0m
COLOR_INFO = \033[32m
COLOR_COMMENT = \033[33m
## Help
help:
printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n"
printf " make [target]\n\n"
printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n"
awk '/^[a-zA-Z\-\_0-9\.@]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${COLOR_INFO}%-16s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
###############
# Environment #
###############
## Setup environment & Install & Build application
setup:
vagrant up --no-provision
vagrant provision
vagrant ssh -- "cd /srv/app && make install build"
## Update environment
update: export ANSIBLE_TAGS = manala.update
update:
vagrant provision
## Update ansible
update-ansible: export ANSIBLE_TAGS = manala.update
update-ansible:
vagrant provision --provision-with ansible
## Provision environment
provision: export ANSIBLE_EXTRA_VARS = {"manala":{"update":false}}
provision:
vagrant provision --provision-with app
## Provision nginx
provision-nginx: export ANSIBLE_TAGS = manala_nginx
provision-nginx: provision
## Provision php
provision-php: export ANSIBLE_TAGS = manala_php
provision-php: provision
###########
# Install #
###########
## Install application
install:
# Composer
composer install --verbose
# Db
bin/console doctrine:database:create --if-not-exists
bin/console doctrine:schema:update --force
# Db - Test
bin/console doctrine:database:create --if-not-exists --env=test
bin/console doctrine:schema:update --force --env=test
# Db - Fixtures
#bin/console doctrine:fixtures:load --no-interaction
# Db - Fixtures - Test
#bin/console doctrine:fixtures:load --no-interaction --env=test
install@test: export SYMFONY_ENV = test
install@test:
# Composer
composer install --verbose --no-progress --no-interaction
# Db
bin/console doctrine:database:drop --force --if-exists
bin/console doctrine:database:create --if-not-exists
bin/console doctrine:schema:update --force
# Db - Fixtures
#bin/console doctrine:fixtures:load --no-interaction
install@demo: export SYMFONY_ENV = prod
install@demo:
# Composer
composer install --verbose --no-progress --no-interaction --prefer-dist --optimize-autoloader
# Symfony cache
bin/console cache:warmup --no-debug
install@prod: export SYMFONY_ENV = prod
install@prod:
# Composer
composer install --verbose --no-progress --no-interaction --prefer-dist --optimize-autoloader --no-dev
# Symfony cache
bin/console cache:warmup --no-debug
#########
# Build #
#########
## Build application
build:
build@demo: export SYMFONY_ENV = prod
build@demo:
build@prod: export SYMFONY_ENV = prod
build@prod:
############
# Security #
############
## Run security checks
security:
security-checker security:check
security@test: export SYMFONY_ENV = test
security@test: security
########
# Lint #
########
## Run lint tools
lint:
php-cs-fixer fix --config-file=.php_cs --dry-run --diff
lint@test: export SYMFONY_ENV = test
lint@test: lint
########
# Test #
########
## Run tests
test: export SYMFONY_ENV = test
test:
# PHPUnit
vendor/bin/phpunit
# Behat
bin/console cache:clear && vendor/bin/behat
test@test: export SYMFONY_ENV = test
test@test:
# PHPUnit
rm -Rf build/phpunit && mkdir -p build/phpunit
stty cols 80 && vendor/bin/phpunit --log-junit build/phpunit/junit.xml --coverage-clover build/phpunit/clover.xml --coverage-html build/phpunit/coverage
# Behat
rm -Rf build/behat && mkdir -p build/behat
bin/console cache:clear && vendor/bin/behat --format=junit --out=build/behat --no-interaction
##########
# Deploy #
##########
## Deploy application (demo)
deploy@demo:
ansible-playbook ansible/deploy.yml --inventory-file=ansible/hosts --limit=deploy_demo
## Deploy application (prod)
deploy@prod:
ansible-playbook ansible/deploy.yml --inventory-file=ansible/hosts --limit=deploy_prod
##########
# Custom #
##########