Skip to content

Commit 722e1eb

Browse files
committed
[FEATURE] Add merge testing job
1 parent 261efdf commit 722e1eb

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

.github/workflows/compute.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
OS: '[ "ubuntu-latest" ]'
1919
COVERAGE: '[ "~9.0.0", "~9.1.0", "~9.2.0", "~10.0.0", "~10.1.0" ]'
2020
PHP: '[ "8.0", "8.1", "8.2", "8.3" ]'
21-
EXCLUDE: '[ { "coverage": "~10.0.0", "php": "8.0" }, { "coverage": "~10.1.0", "php": "8.0" } ]'
21+
EXCLUDE: '[ { "coverage": "10", "php": "8.0" }, { "coverage": "~10.0.0", "php": "8.0" }, { "coverage": "~10.1.0", "php": "8.0" } ]'
2222

2323
jobs:
2424
compute:

.github/workflows/test.yml

+76
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,79 @@ jobs:
8585
name: phpunit-logs-${{ runner.os }}-${{ matrix.php }}-${{ steps.version-cache.outputs.major }}-${{ matrix.coverage }}
8686
path: .Log/*
8787
retention-days: 1
88+
89+
merge:
90+
name: 'Merge COVERAGE: ${{ matrix.coverage }} - PHP: ${{ matrix.php }}'
91+
92+
needs: [ compute, build ]
93+
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
os: ${{ fromJson(needs.compute.outputs.os) }}
98+
coverage: ${{ fromJson(needs.compute.outputs.major) }}
99+
php: ${{ fromJson(needs.compute.outputs.php) }}
100+
exclude: ${{ fromJson(needs.compute.outputs.exclude) }}
101+
102+
runs-on: ${{ matrix.os }}
103+
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@v4
107+
108+
- name: Download PHPUnit logs
109+
uses: actions/download-artifact@v4
110+
with:
111+
path: .Log
112+
pattern: phpunit-logs-${{ runner.os }}-${{ matrix.php }}-${{ matrix.coverage }}-*
113+
merge-multiple: true
114+
115+
- name: Store Composer cache directory
116+
id: composer-cache
117+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
118+
119+
- uses: actions/cache/restore@v4
120+
id: restore-composer-cache
121+
with:
122+
path: ${{ steps.composer-cache.outputs.dir }}
123+
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.coverage }}
124+
restore-keys: |
125+
${{ runner.os }}-${{ matrix.php }}-
126+
${{ runner.os }}-
127+
128+
- name: Set up PHP Version ${{ matrix.php }}
129+
uses: shivammathur/setup-php@v2
130+
with:
131+
php-version: ${{ matrix.php }}
132+
coverage: xdebug
133+
tools: composer:v2
134+
135+
- name: Environment Check
136+
run: |
137+
php --version
138+
composer --version
139+
140+
- name: Validate composer.json
141+
run: composer validate
142+
143+
- name: Composer install
144+
run: composer update --with "phpunit/php-code-coverage:^${{ matrix.coverage }}.0" --no-interaction
145+
146+
- name: Save composer cache
147+
uses: actions/cache/save@v4
148+
with:
149+
path: ${{ steps.composer-cache.outputs.dir }}
150+
key: ${{ steps.restore-composer-cache.outputs.cache-primary-key }}
151+
152+
- name: Merge log files
153+
run: bin/phpunit-merger log .Log/log/ .Log/junit.xml
154+
155+
- name: Merge coverage files
156+
run: bin/phpunit-merger coverage .Log/coverage/ .Log/coverage.xml
157+
158+
- name: Archive PHPUnit logs
159+
uses: actions/upload-artifact@v4
160+
with:
161+
name: phpunit-logs-merged-${{ runner.os }}-${{ matrix.php }}-${{ matrix.coverage }}
162+
path: .Log/*
163+
retention-days: 1

0 commit comments

Comments
 (0)