-
Notifications
You must be signed in to change notification settings - Fork 9
/
Taskfile.php.yml
53 lines (47 loc) · 1.72 KB
/
Taskfile.php.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
version: 3
vars:
# Required variables
PHP_VERSION: '{{ .PHP_VERSION }}'
PHPUNIT_VERSION: '{{ .PHPUNIT_VERSION }}'
# Defaulted variable
COMPOSER_VERSION: '{{ .COMPOSER_VERSION | default "2" }}'
COMPOSE_SERVICE: '{{ .COMPOSE_SERVICE | default "php" }}'
PHPUNIT_FILE: '{{ .PHPUNIT_FILE | default "phpunit.dist.xml" }}'
env:
PHP_VERSION: '{{ .PHP_VERSION }}'
COMPOSER_VERSION: '{{ .COMPOSER_VERSION }}'
tasks:
docker:build:
internal: true
desc: Build the PHP test container
cmds:
- docker compose build --pull {{ .COMPOSE_SERVICE }}
tests:
desc: Execute PHPUnit tests on PHP {{ .PHP_VERSION }}
deps:
- docker:build
cmds:
- >-
{{ if eq .PHP_VERSION "5.6" "7.0" }}
docker compose run --rm {{ .COMPOSE_SERVICE }} ./tests/legacy_tests.sh
{{ else }}
docker compose run --rm {{ .COMPOSE_SERVICE }} composer exec phpunit --verbose -- --configuration {{ .PHPUNIT_FILE }} --testsuite "Alma PHP Client Unit Test Suite" --coverage-xml ./.coverage
{{ end }}
tests:integration:
desc: Execute intregration tests
deps:
- docker:build
cmds:
- >-
{{ if eq .PHP_VERSION "5.6" "7.0" }}
docker compose run --rm {{ .COMPOSE_SERVICE }} ./tests/legacy_integration_tests.sh
{{ else }}
docker compose run --rm {{ .COMPOSE_SERVICE }} composer exec phpunit --verbose -- --configuration {{ .PHPUNIT_FILE }} --testsuite "Alma PHP Client Integration Test Suite"
{{ end }}
shell:
desc: Connect to PHP container
deps:
- docker:build
cmds:
- sed 's/{MYVERSION}/{{ .PHPUNIT_VERSION }}/g' {{ .PHPUNIT_FILE }} > phpunit.xml
- docker compose run --rm {{ .COMPOSE_SERVICE }} bash