@@ -13,57 +13,72 @@ jobs:
13
13
strategy :
14
14
matrix :
15
15
include :
16
- - PHP_VERSION : 7.1
16
+ - PHP_VERSION : " 7.1"
17
17
CODE_COVERAGE : false
18
18
RUN_PHPSTAN : false
19
19
RUN_PSALM : false
20
20
RUN_BENCHMARK : false
21
- - PHP_VERSION : 7.2
22
- CODE_COVERAGE : true
21
+ - PHP_VERSION : " 7.2"
22
+ CODE_COVERAGE : false
23
23
RUN_PHPSTAN : false
24
24
RUN_PSALM : false
25
25
RUN_BENCHMARK : true
26
- - PHP_VERSION : 7.3
27
- CODE_COVERAGE : true
26
+ - PHP_VERSION : " 7.3"
27
+ CODE_COVERAGE : false
28
28
RUN_PHPSTAN : false
29
29
RUN_PSALM : false
30
30
RUN_BENCHMARK : false
31
- - PHP_VERSION : 7.4
32
- CODE_COVERAGE : true
31
+ - PHP_VERSION : " 7.4"
32
+ CODE_COVERAGE : false
33
33
RUN_PHPSTAN : true
34
- RUN_PSALM : true
34
+ RUN_PSALM : false
35
35
RUN_BENCHMARK : false
36
- - PHP_VERSION : 8.0
37
- CODE_COVERAGE : true
36
+ - PHP_VERSION : " 8.0"
37
+ CODE_COVERAGE : false
38
38
RUN_PHPSTAN : true
39
- RUN_PSALM : true
39
+ RUN_PSALM : false
40
+ RUN_BENCHMARK : false
41
+ - PHP_VERSION : " 8.1"
42
+ CODE_COVERAGE : false
43
+ RUN_PHPSTAN : false
44
+ RUN_PSALM : false
40
45
RUN_BENCHMARK : false
41
- - PHP_VERSION : 8.1
46
+ - PHP_VERSION : " 8.2"
47
+ CODE_COVERAGE : false
48
+ RUN_PHPSTAN : false
49
+ RUN_PSALM : false
50
+ RUN_BENCHMARK : true
51
+ - PHP_VERSION : " 8.3"
42
52
CODE_COVERAGE : true
43
- RUN_PHPSTAN : true
53
+ RUN_PHPSTAN : false
44
54
RUN_PSALM : true
45
- RUN_BENCHMARK : true
55
+ RUN_BENCHMARK : false
56
+ - PHP_VERSION : " 8.4"
57
+ CODE_COVERAGE : false
58
+ RUN_PHPSTAN : true
59
+ RUN_PSALM : false
60
+ RUN_BENCHMARK : false
46
61
47
62
steps :
48
- - uses : actions/checkout@v2
63
+ - uses : actions/checkout@v4
49
64
50
65
- name : Cache Docker Image
51
66
id : cache-docker-image
52
- uses : actions/cache@v2
67
+ uses : actions/cache@v4
53
68
with :
54
69
path : /tmp/docker-image.tar
55
- key : cache-docker-image-test:${{ matrix.PHP_VERSION }}
70
+ key : cache-docker-image-test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE && '-xdebug' || '' }}
56
71
57
72
- name : Load Docker Image
58
73
if : steps.cache-docker-image.outputs.cache-hit == 'true'
59
74
run : docker load --input /tmp/docker-image.tar
60
75
61
76
- name : Build Docker Image
62
77
if : steps.cache-docker-image.outputs.cache-hit != 'true'
63
- run : docker build -f .github/workflows/test.Dockerfile -t 'test:${{ matrix.PHP_VERSION }}' --build-arg 'PHP_VERSION=${{ matrix.PHP_VERSION }}' .
78
+ run : docker build -f .github/workflows/test.Dockerfile -t 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE && '-xdebug' || '' }}' --build-arg 'PHP_VERSION=${{ matrix.PHP_VERSION }}' --build-arg 'CODE_COVERAGE=${{ matrix.CODE_COVERAGE }}' .
64
79
65
80
- name : Cache Composer Cache Files
66
- uses : actions/cache@v2
81
+ uses : actions/cache@v4
67
82
with :
68
83
path : /tmp/composer-cache-files
69
84
key : cache-composer-cache-files-${{ matrix.PHP_VERSION }}
@@ -75,12 +90,12 @@ jobs:
75
90
if [ "${{ matrix.RUN_PHPSTAN }}" != "true" ]; then composer remove --dev phpstan/phpstan --no-update --no-interaction; fi
76
91
if [ "${{ matrix.RUN_PSALM }}" != "true" ]; then composer remove --dev vimeo/psalm --no-update --no-interaction; fi
77
92
if [ "${{ matrix.RUN_BENCHMARK }}" != "true" ]; then composer remove --dev phpbench/phpbench --no-update --no-interaction; fi
78
- docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" -v '/tmp/composer-cache-files:/.composer' 'test:${{ matrix.PHP_VERSION }}' composer install --no-interaction --no-progress --prefer-dist ${{ matrix.COMPOSER_EXTRA_ARGS }}
93
+ docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" -v '/tmp/composer-cache-files:/.composer' 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE && '-xdebug' || '' }} ' composer install --no-interaction --no-progress --prefer-dist ${{ matrix.COMPOSER_EXTRA_ARGS }}
79
94
80
95
- name : Run Unit Test
81
96
run : |
82
97
if [ "${{ matrix.CODE_COVERAGE }}" == "true" ]; then
83
- docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}' php -d 'zend.assertions=1' -d 'pcov.enabled=1 ' ./vendor/bin/phpunit --coverage-clover=.clover.xml
98
+ docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}-xdebug ' php -d 'zend.assertions=1' -d 'xdebug.mode=coverage ' ./vendor/bin/phpunit --coverage-clover=.clover.xml
84
99
else
85
100
docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}' php -d 'zend.assertions=1' ./vendor/bin/phpunit
86
101
fi
@@ -94,16 +109,16 @@ jobs:
94
109
95
110
- name : Run PHPStan
96
111
if : ${{ matrix.RUN_PHPSTAN }}
97
- run : docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}' php -d 'memory_limit=2G' ./vendor/bin/phpstan analyse --level max src/ tests/
112
+ run : docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE && '-xdebug' || '' }} ' php -d 'memory_limit=2G' ./vendor/bin/phpstan analyse --level max src/ tests/
98
113
99
114
- name : Run psalm
100
115
if : ${{ matrix.RUN_PSALM }}
101
- run : mkdir -p "$HOME/.cache/psalm" && docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" -v "$HOME/.cache/psalm:/.cache/psalm" 'test:${{ matrix.PHP_VERSION }}' php ./vendor/bin/psalm
116
+ run : mkdir -p "$HOME/.cache/psalm" && docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" -v "$HOME/.cache/psalm:/.cache/psalm" 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE && '-xdebug' || '' }} ' php ./vendor/bin/psalm
102
117
103
118
- name : Run benchmark
104
119
if : ${{ matrix.RUN_BENCHMARK }}
105
- run : docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}' php -d 'zend.assertions=-1' ./vendor/bin/phpbench run --no-interaction --revs=1 --retry-threshold=100 --progress=none
120
+ run : docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE && '-xdebug' || '' }} ' php -d 'zend.assertions=-1' ./vendor/bin/phpbench run --no-interaction --revs=1 --retry-threshold=100 --progress=none
106
121
107
122
- name : Export Docker Image
108
123
if : steps.cache-docker-image.outputs.cache-hit != 'true'
109
- run : docker save --output /tmp/docker-image.tar 'test:${{ matrix.PHP_VERSION }}'
124
+ run : docker save --output /tmp/docker-image.tar 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE && '-xdebug' || '' }} '
0 commit comments