-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
135 lines (104 loc) · 2.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
SHELL = /bin/bash
uid = $$(id -u)
gid = $$(id -g)
pwd = $$(pwd)
default: help
##
## Help
## ----
##
## help Print commands help.
.PHONY: help
help: Makefile
@sed -n 's/^##//p' $<
##
## Docker
## ------
##
## build Build the Docker images.
.PHONY: build
build:
docker compose build
## up Start the Docker stack.
.PHONY: up
up: .up
.up:
docker compose up -d
## down Stop the Docker stack.
.PHONY: down
down: .down
.down:
docker compose down
## update Rebuild Docker images and start stack.
.PHONY: update
update: build up
## reset Teardown stack, install and start.
.PHONY: reset
reset: .reset
.PHONY: .reset
.reset: .down .install .up
## install Install PHP dependencies with the default PHP version (8.2).
.PHONY: .install
install: install-8.3
## install-8.2 Install PHP dependencies with PHP 8.2.
.PHONY: install-8.2
install-8.2:
docker compose run --rm php-8.2 composer install
## install-8.3 Install PHP dependencies with PHP 8.3.
.PHONY: install-8.3
install-8.3:
docker compose run --rm php-8.3 composer install
## php-cli Enter a shell for the default PHP version (8.2).
.PHONY: php-cli
php-cli: php-8.3-cli
## php-8.2-cli Enter a shell for PHP 8.2.
.PHONY: php-8.2-cli
php-8.2-cli:
docker compose run --rm php-8.2 sh
## php-8.3-cli Enter a shell for PHP 8.3.
.PHONY: php-8.3-cli
php-8.3-cli:
docker compose run --rm php-8.3 sh
##
## Tests and code validation
## -------------------------
##
## verify Run all validations and tests.
.PHONY: verify
verify: php-code-validation php-tests
## php-tests Run the tests for all relevant PHP versions.
.PHONY: php-tests
php-tests: php-8.2-tests php-8.3-tests
## php-8.2-tests Run tests with PHP 8.2.
.PHONY: php-8.2-tests
php-8.2-tests:
docker compose run --rm php-8.2 ./vendor/bin/phpunit
## php-8.3-tests Run tests with PHP 8.3.
.PHONY: php-8.3-tests
php-8.3-tests:
docker compose run --rm php-8.3 ./vendor/bin/phpunit
## php-8.2-tests-html-coverage Run the tests with PHP 8.2 including coverage report as HTML.
.PHONY: php-8.2-tests-html-coverage
php-8.2-tests-html-coverage:
docker compose run --rm php-8.2 ./vendor/bin/phpunit --coverage-html ./coverage
## php-8.3-tests-html-coverage Run the tests with PHP 8.3 including coverage report as HTML.
.PHONY: php-8.3-tests-html-coverage
php-8.3-tests-html-coverage:
docker compose run --rm php-8.3 ./vendor/bin/phpunit --coverage-html ./coverage
## php-code-validation Run code fixers and linters with default PHP version (8.2).
.PHONY: php-code-validation
php-code-validation:
docker compose run --rm php-8.3 ./vendor/bin/php-cs-fixer fix
docker compose run --rm php-8.3 ./vendor/bin/psalm --show-info=false --no-diff
##
## CI
## --
##
## php-8.2-tests-ci Run the tests for PHP 8.2 for CI.
.PHONY: php-8.2-tests-ci
php-8.2-tests-ci:
docker compose run --rm php-8.2 ./vendor/bin/phpunit
## php-8.3-tests-ci Run the tests for PHP 8.3 for CI.
.PHONY: php-8.3-tests-ci
php-8.3-tests-ci:
docker compose run --rm php-8.3 ./vendor/bin/phpunit --coverage-clover ./coverage.xml