Skip to content

Commit e6fa102

Browse files
committed
GH Actions/test: fix coverage cache warming
The PHPUnit coverage cache warming step was not being run for PHPUnit 10 or 11, while it should be to prevent issues with PHP Parser, like this: ``` Message: Token T_PUBLIC_SET has ID of type string, should be int. You may be using a library with broken token emulation Location: /home/runner/work/PHP_CodeSniffer/PHP_CodeSniffer/vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php:35 ``` This commit should fix this.
1 parent bf15828 commit e6fa102

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,16 @@ jobs:
334334
run: |
335335
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
336336
echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
337+
echo 'WARM_CACHE=true' >> "$GITHUB_OUTPUT"
337338
elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
338339
echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
340+
echo 'WARM_CACHE=true' >> "$GITHUB_OUTPUT"
341+
elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '9.5' ) }}" == "true" ]; then
342+
echo 'FILE=phpunit-lte9.xml.dist' >> "$GITHUB_OUTPUT"
343+
echo 'WARM_CACHE=true' >> "$GITHUB_OUTPUT"
339344
else
340345
echo 'FILE=phpunit-lte9.xml.dist' >> "$GITHUB_OUTPUT"
346+
echo 'WARM_CACHE=false' >> "$GITHUB_OUTPUT"
341347
fi
342348
343349
- name: 'PHPCS: set the path to PHP'
@@ -348,7 +354,7 @@ jobs:
348354
# As of PHPUnit 9.3.4, a cache warming option is available.
349355
# Using that option prevents issues with PHP-Parser backfilling PHP tokens during our test runs.
350356
- name: "Warm the PHPUnit cache (PHPUnit 9.3+)"
351-
if: ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
357+
if: ${{ steps.phpunit_config.outputs.WARM_CACHE == 'true' }}
352358
run: >
353359
php "vendor/bin/phpunit" -c ${{ steps.phpunit_config.outputs.FILE }}
354360
--coverage-cache ./build/phpunit-cache --warm-coverage-cache

0 commit comments

Comments
 (0)