-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
163 lines (120 loc) · 3.79 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
composer ?= composer
PHPUNIT_OPTS =
symfony = symfony
php = php
docker = docker
cargo = cargo
mdbook = mdbook
help: Makefile
@echo
@echo " Choose a command run in Helium:"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
## purge: Clear the cache
.PHONY: purge
purge:
@echo ">> ============= Clear Cache ============= <<"
-rm -rf var/cache/*
-rm -rf var/logs/*
-rm var/data.db
## composer: Install packages
.PHONY: composer
composer:
@echo ">> ============= Install Packages ============= <<"
@$(composer) install
## prod_composer: Install packages on production
.PHONY: prod_composer
prod_composer:
@echo ">> ============= Install Packages On Production ============= <<"
@$(composer) install --no-dev --optimize-autoloader
## fix-diff: Format diff
.PHONY: fix-diff
fix-diff:
@echo ">> ============= Fix code diff ============= <<"
./vendor/bin/php-cs-fixer fix --diff --dry-run -v
## migrate: Migrate the database
.PHONY: migrate
migrate:
@echo ">> ============= Run db migration ============= <<"
@$(php) bin/console doctrine:schema:update --force
## test: Run test cases
.PHONY: test
test: purge composer migrate
@echo ">> ============= Run test cases ============= <<"
bin/phpunit -c . $(PHPUNIT_OPTS) --log-junit build/phpunit.xml --coverage-text
## lint: Lint all the things
.PHONY: lint
lint: purge composer migrate
@echo ">> ============= Lint all the things ============= <<"
@! grep -lIUr --color '^M' config/ src/ composer.json composer.lock || ( echo '[ERROR] Above files have CRLF line endings' && exit 1 )
$(composer) validate --strict
./bin/console lint:yaml config
@find config -type f -name \*.yaml | while read file; do echo -n "$$file"; php bin/console --no-debug --no-interaction --env=test lint:yaml "$$file" || exit 1; done
@find src tests -type f -name \*.php | while read file; do php -l "$$file" || exit 1; done
./vendor/bin/phpcs
./vendor/bin/php-cs-fixer fix --diff --dry-run -v
## coverage: Get Coverage Report
.PHONY: coverage
coverage: cc composer
@echo ">> ============= Get Coverage Report ============= <<"
mkdir -p build/coverage
bin/phpunit --log-junit build/phpunit.xml
## fix: Fix Style Issues
.PHONY: fix
fix:
@echo ">> ============= Fix Code Format ============= <<"
./vendor/bin/php-cs-fixer fix
## run: Run Helium
.PHONY: run
run:
@echo ">> ============= Run App ============= <<"
@$(symfony) serve --no-tls
## installed: Show a list of installed packages
.PHONY: installed
installed:
@echo ">> ============= Show Installed Packages ============= <<"
@$(composer) show -i
## outdated: Show a list of outdated packages
.PHONY: outdated
outdated:
@echo ">> ============= Show Outdated Packages ============= <<"
@$(composer) outdated
## db: Run a db container
.PHONY: db
db:
@echo ">> ============= Run a docker container ============= <<"
@$(docker) run -d --name=mysql-server \
-p 3306:3306 \
-v mysql-data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=root mysql
## mdbook: Install mdbook rust package (Rust and Cargo needed)
.PHONY: mdbook
mdbook:
@echo ">> ============= Install mdbook ============= <<"
@$(cargo) install mdbook
## docs: Build docs
.PHONY: docs
docs:
@echo ">> ============= Building docs ============= <<"
@$(mdbook) build docs
## dasyn: Debug async messages and handlers
.PHONY: dasyn
dasyn:
@echo ">> ============= Debug Messenger ============= <<"
@$(php) bin/console debug:messenger
## worker: Run async tasks
.PHONY: worker
worker:
@echo ">> ============= Run Worker ============= <<"
@$(php) bin/console messenger:consume async -vv
## watch: Watch for new newsletters
.PHONY: watch
watch:
@echo ">> ============= Watch Newsletter ============= <<"
@$(php) bin/console watch
## ci: Run CI Checks
.PHONY: ci
ci: config purge composer lint test
@echo "All Quality Checks Passed"
.PHONY: help