@@ -13,57 +13,72 @@ jobs:
1313 strategy :
1414 matrix :
1515 include :
16- - PHP_VERSION : 7.1
16+ - PHP_VERSION : " 7.1"
1717 CODE_COVERAGE : false
1818 RUN_PHPSTAN : false
1919 RUN_PSALM : false
2020 RUN_BENCHMARK : false
21- - PHP_VERSION : 7.2
22- CODE_COVERAGE : true
21+ - PHP_VERSION : " 7.2"
22+ CODE_COVERAGE : false
2323 RUN_PHPSTAN : false
2424 RUN_PSALM : false
2525 RUN_BENCHMARK : true
26- - PHP_VERSION : 7.3
27- CODE_COVERAGE : true
26+ - PHP_VERSION : " 7.3"
27+ CODE_COVERAGE : false
2828 RUN_PHPSTAN : false
2929 RUN_PSALM : false
3030 RUN_BENCHMARK : false
31- - PHP_VERSION : 7.4
32- CODE_COVERAGE : true
31+ - PHP_VERSION : " 7.4"
32+ CODE_COVERAGE : false
3333 RUN_PHPSTAN : true
34- RUN_PSALM : true
34+ RUN_PSALM : false
3535 RUN_BENCHMARK : false
36- - PHP_VERSION : 8.0
37- CODE_COVERAGE : true
36+ - PHP_VERSION : " 8.0"
37+ CODE_COVERAGE : false
3838 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
4045 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"
4252 CODE_COVERAGE : true
43- RUN_PHPSTAN : true
53+ RUN_PHPSTAN : false
4454 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
4661
4762 steps :
48- - uses : actions/checkout@v2
63+ - uses : actions/checkout@v4
4964
5065 - name : Cache Docker Image
5166 id : cache-docker-image
52- uses : actions/cache@v2
67+ uses : actions/cache@v4
5368 with :
5469 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' || '' }}
5671
5772 - name : Load Docker Image
5873 if : steps.cache-docker-image.outputs.cache-hit == 'true'
5974 run : docker load --input /tmp/docker-image.tar
6075
6176 - name : Build Docker Image
6277 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 }}' .
6479
6580 - name : Cache Composer Cache Files
66- uses : actions/cache@v2
81+ uses : actions/cache@v4
6782 with :
6883 path : /tmp/composer-cache-files
6984 key : cache-composer-cache-files-${{ matrix.PHP_VERSION }}
@@ -75,12 +90,12 @@ jobs:
7590 if [ "${{ matrix.RUN_PHPSTAN }}" != "true" ]; then composer remove --dev phpstan/phpstan --no-update --no-interaction; fi
7691 if [ "${{ matrix.RUN_PSALM }}" != "true" ]; then composer remove --dev vimeo/psalm --no-update --no-interaction; fi
7792 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 }}
7994
8095 - name : Run Unit Test
8196 run : |
8297 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
8499 else
85100 docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}' php -d 'zend.assertions=1' ./vendor/bin/phpunit
86101 fi
@@ -94,16 +109,16 @@ jobs:
94109
95110 - name : Run PHPStan
96111 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/
98113
99114 - name : Run psalm
100115 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
102117
103118 - name : Run benchmark
104119 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
106121
107122 - name : Export Docker Image
108123 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