Makefile
1.24 KB
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
# Tutorial: http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
# Docs: https://www.gnu.org/software/make/
.PHONY: precommit
.PHONY: dupes comp jest phpunit test dev prod
.PHONY: setup test
setup:: vendor/autoload.php
setup:: yarn.lock
setup:: githooks
#test:: jest
test:: phpunit
precommit:: validate-composer
precommit:: validate-yarn
precommit:: dupes
precommit:: compatibility
# precommit
dupes: vendor/autoload.php
./.make/check-duplicates.sh
compatibility: vendor/autoload.php
./.make/check-compatibility.sh
validate-composer: composer.lock
./.make/check-composer.sh
validate-yarn: yarn.lock
./.make/check-yarn.sh
# Dependency managers
## Composer
composer.lock: composer.json
composer install
touch $@
composer.json:
composer init -q
vendor/autoload.php: composer.lock
composer install
touch $@
## Yarn
yarn.lock: package.json
yarn install
touch $@
# Setup
githooks:
ifndef CI
find .git/hooks -type l -exec rm {} \;
find .githooks -type f -exec ln -sf ../../{} .git/hooks/ \;
else
echo 'Skipping in CI'
endif
# Tests
jest: yarn.lock
yarn run test
phpunit: vendor/autoload.php
vendor/bin/phpunit --fail-on-warning
# Install
install:
composer install
yarn install
# Build
dev prod: yarn.lock
yarn run build:$@