Skip to content

Commit d7cef5f

Browse files
committed
Update CI workflow
- Always upload `coverage.xml` if it is generated - Downgrade to PHP 8.2 on macOS to work around slow-running tests issue
1 parent bf7285b commit d7cef5f

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ jobs:
112112
- macos-latest
113113
php-version:
114114
- "8.3"
115+
- "8.2"
115116
include:
116-
- os: ubuntu-latest
117-
php-version: "8.2"
118117
- os: ubuntu-latest
119118
php-version: "8.1"
120119
- os: ubuntu-latest
@@ -123,6 +122,13 @@ jobs:
123122
php-version: "7.4"
124123
- os: windows-latest
125124
php-version: "7.4"
125+
exclude:
126+
# As of 2024-03-13, macos-latest + 8.3 is slooooow (5+ seconds per
127+
# process spawned?), but macos-latest + 8.2 runs normally
128+
- os: macos-latest
129+
php-version: "8.3"
130+
- os: windows-latest
131+
php-version: "8.2"
126132

127133
runs-on: ${{ matrix.os }}
128134

@@ -167,19 +173,27 @@ jobs:
167173
done
168174
169175
- name: Start Mockoon CLI
176+
id: start-mockoon
170177
shell: bash
171178
run: scripts/start-mockoon.sh
172179

173180
- name: Run PHPUnit tests and generate code coverage report
174-
run: vendor/bin/phpunit --no-coverage --coverage-clover=coverage.xml
181+
id: run-phpunit-tests
182+
shell: bash
183+
run: |
184+
vendor/bin/phpunit --no-coverage --coverage-clover=coverage.xml && status=0 || status=$?
185+
printf 'coverage_report_generated=%d\n' "$([[ -s coverage.xml ]] && echo 1 || echo 0)" >>"$GITHUB_OUTPUT"
186+
(exit $status)
187+
188+
- name: Upload code coverage report to Codecov
189+
if: ${{ !cancelled() && steps.run-phpunit-tests.outputs.coverage_report_generated == 1 }}
190+
uses: codecov/codecov-action@v4
191+
with:
192+
token: ${{ secrets.CODECOV_TOKEN }}
175193

176194
- name: Upload Mockoon CLI log files artifact
195+
if: ${{ !cancelled() && steps.start-mockoon.conclusion == 'success' }}
177196
uses: actions/upload-artifact@v4
178197
with:
179198
name: mockoon-cli-logs-${{ matrix.os }}-${{ matrix.php-version }}
180199
path: ~/.mockoon-cli/logs/*.log
181-
182-
- name: Upload code coverage report to Codecov
183-
uses: codecov/codecov-action@v4
184-
with:
185-
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)