-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
147 lines (106 loc) · 3.24 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
.SILENT:
.PHONY: help
## 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)
#########
# Setup #
#########
## Setup environment & Install application
setup: provision
vagrant ssh -c 'cd /srv/app/symfony && make install'
setup@test: provision@test install@test
#############
# Provision #
#############
## Provision environment
provision: provision-vagrant
provision@test: provision-ansible@test
provision-services@test: provision-services-ansible@test
provision-vagrant:
ansible-galaxy install -r ansible/roles.yml -p ansible/roles -f
vagrant up --no-provision
vagrant provision
provision-ansible@test:
ansible-galaxy install -r ansible/roles.yml -p ansible/roles -f
ansible-playbook -i ansible/hosts -l env_test,app -s -e "_user=${_ANSIBLE_USER}" --force-handlers ansible/playbook.yml
provision-services-ansible@test:
ansible-playbook -i ansible/hosts -l env_test,app -s -e "_user=${_ANSIBLE_USER}" --force-handlers --tags=elao_services ansible/playbook.yml
###########
# Install #
###########
## Install application
install: install-app install-db install-db@test install-db-fixtures install-db-fixtures@test install-dep build
install@test: install-app@test install-db@test install-db-fixtures@test install-dep build@prod
install@prod: install-dep build@prod
install-app:
composer --no-progress --no-interaction install
install-app@test:
SYMFONY_ENV=test composer --no-progress --no-interaction install
install-db:
bin/console doctrine:database:create --if-not-exists
bin/console doctrine:schema:update --force
install-db@test:
bin/console doctrine:database:drop --force --if-exists --env=test
bin/console doctrine:database:create --env=test
bin/console doctrine:schema:create --env=test
install-db-fixtures:
#bin/console doctrine:fixtures:load -n
install-db-fixtures@test:
#bin/console doctrine:fixtures:load -n --env=test
install-dep:
npm --no-spin install
#########
# Build #
#########
## Build application
build: build-assets
build@prod: build-assets@prod
build-assets:
gulp --dev
build-assets@prod:
gulp
########
# Test #
########
## Run tests
test: test-phpunit test-behat
test@test: test-phpunit@test test-behat@test
test-phpunit:
bin/phpunit
test-phpunit@test:
rm -rf var/tests/junit.xml var/tests/clover.xml var/tests/coverage
stty cols 80; bin/phpunit --log-junit var/tests/junit.xml --coverage-clover var/tests/clover.xml --coverage-html var/tests/coverage
test-behat:
bin/behat
test-behat@test:
bin/behat --format=progress --no-interaction
##########
# Deploy #
##########
## Deploy application (demo)
deploy@demo: deploy-capifony@demo
## Deploy application (prod)
deploy@prod: deploy-capifony@prod
deploy-capifony@demo:
cap demo deploy
deploy-capifony@prod:
cap prod deploy
##########
# Custom #
##########