Skip to content

Commit 0ca5afc

Browse files
authored
Merge pull request #108 from jrfnl/feature/tests-migrate-configuration
2 parents 2d6ceb0 + bda10a7 commit 0ca5afc

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

.github/workflows/reusable-testing.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,26 @@ jobs:
240240
# Bust the cache at least once a month - output format: YYYY-MM.
241241
custom-cache-suffix: $(date -u "+%Y-%m")
242242

243+
- name: Grab PHPUnit version
244+
id: phpunit_version
245+
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
246+
247+
- name: Determine PHPUnit flavour
248+
id: phpunit_version
249+
run: |
250+
if [ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
251+
echo 'FLAVOUR=gte10' >> $GITHUB_OUTPUT
252+
else
253+
echo 'FLAVOUR=lte9' >> $GITHUB_OUTPUT
254+
fi
255+
256+
# PHPUnit 10 may fail a test run when the "old" configuration format is used.
257+
# Luckily, there is a build-in migration tool since PHPUnit 9.3.
258+
- name: Migrate PHPUnit configuration for PHPUnit 10+
259+
if: ${{ steps.phpunit_version.outputs.FLAVOUR == 'gte10' }}
260+
continue-on-error: true
261+
run: composer phpunit -- --migrate-configuration
262+
243263
- name: Setup problem matcher to provide annotations for PHPUnit
244264
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
245265

0 commit comments

Comments
 (0)