-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Taskfile.yml
109 lines (95 loc) · 3.17 KB
/
Taskfile.yml
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
version: '3'
vars:
PHP: php
COMPOSER: composer
REQUIRE_CHECKER: "{{.PHP}} tools/composer-require-checker/vendor/bin/composer-require-checker"
PSALM: "{{.PHP}} tools/psalm/vendor/bin/psalm --show-info --no-diff --no-cache"
PHPUNIT: "{{.PHP}} tools/phpunit/vendor/bin/phpunit"
INFECTION: "{{.PHP}} vendor/bin/infection --threads=max --show-mutations"
PACKAGES:
sh: find src -type d -maxdepth 1 -mindepth 1 -exec basename {} ';'
tasks:
install:
cmd: "{{.COMPOSER}} install"
sources:
- composer.json
- tools/*/composer.json
generates:
- vendor/autoload.php
var:
cmd: mkdir -p var
status:
- test -d var
silent: true
internal: true
fixcs:
deps: [var, install]
cmds:
- "{{.PHP}} vendor/bin/php-cs-fixer fix --verbose --config=.visitors.php-cs-fixer.dist.php {{.CLI_ARGS}}"
- "{{.PHP}} vendor/bin/php-cs-fixer fix --verbose {{.CLI_ARGS}}"
lint:
cmds:
- task: fixcs
vars:
CLI_ARGS: "--dry-run {{.CLI_ARGS}}"
psalm:
deps: [install]
cmd: "{{.PSALM}} {{.CLI_ARGS}}"
phpstan:
deps: [var, install]
cmd: "{{.PHP}} vendor/bin/phpstan --verbose {{.CLI_ARGS}}"
test:
deps: [var, install]
cmd: "{{.PHPUNIT}} {{.CLI_ARGS}}"
infection:
deps: [var, install]
cmd: "{{.INFECTION}} {{.CLI_ARGS}}"
composer-normalize-fix:
deps: [install]
cmds:
- "{{.COMPOSER}} normalize --diff {{.CLI_ARGS}}"
- for: { var: PACKAGES, as: PACKAGE }
cmd: "{{.COMPOSER}} normalize --diff src/{{.PACKAGE}}/composer.json {{.CLI_ARGS}}"
- "{{.COMPOSER}} normalize --diff tools/composer-require-checker/composer.json {{.CLI_ARGS}}"
- "{{.COMPOSER}} normalize --diff tools/psalm/composer.json {{.CLI_ARGS}}"
composer-validate:
deps: [install]
cmds:
- task: composer-normalize-fix
vars:
CLI_ARGS: --dry-run
- "{{.COMPOSER}} validate --strict --no-check-publish"
- for: { var: PACKAGES, as: PACKAGE }
cmd: "{{.COMPOSER}} validate --strict src/{{.PACKAGE}}/composer.json"
composer-check-require:
deps: [install]
cmd: "{{.REQUIRE_CHECKER}}"
check-packages:
deps: [install]
cmds:
- for: { var: PACKAGES, as: PACKAGE }
task: check-package
vars:
NAME: "{{.PACKAGE}}"
check-package:
deps: [install]
requires:
vars: [NAME]
vars:
PATH: var/{{.NAME}}.isolated.test
cmds:
- 'rm -rf {{.PATH}}'
- 'mkdir -p {{.PATH}}'
- 'ln -s ../../src/{{.NAME}} {{.PATH}}/src'
- 'ln -s ../../stubs {{.PATH}}/stubs'
- 'ln -s ../../tests/isolated_package_testing/psalm.xml {{.PATH}}/psalm.xml.dist'
- 'cat {{.PATH}}/src/composer.json | {{.PHP}} tests/isolated_package_testing/process_composer_json.php > {{.PATH}}/composer.json'
- '{{.COMPOSER}} --working-dir={{.PATH}} update --prefer-lowest --prefer-stable'
- '{{.REQUIRE_CHECKER}} check {{.PATH}}/composer.json'
- '{{.PSALM}} --root={{.PATH}}'
- |
if [ -d tests/{{.NAME}} ]; then
ln -s ../../tests/{{.NAME}} {{.PATH}}/tests
{{.PHPUNIT}} --bootstrap={{.PATH}}/vendor/autoload.php {{.PATH}}/tests
fi
- 'rm -rf {{.PATH}}'