Skip to content

Commit 8ea3563

Browse files
no message
1 parent 3f2e7a0 commit 8ea3563

File tree

4 files changed

+93
-55
lines changed

4 files changed

+93
-55
lines changed

.github/workflows/coverage.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/coveralls.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Coveralls
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Integration Tests", "Unit Tests"]
6+
types: [completed]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
finalize:
14+
runs-on: ubuntu-latest
15+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
16+
steps:
17+
- id: check
18+
name: Verify all prerequisite workflows succeeded
19+
uses: actions/github-script@v7
20+
with:
21+
script: |
22+
const {owner, repo} = context.repo;
23+
const headSha = context.payload.workflow_run?.head_sha || context.sha;
24+
25+
const runs = await github.rest.actions.listWorkflowRunsForRepo({
26+
owner,
27+
repo,
28+
head_sha: headSha,
29+
status: 'completed',
30+
per_page: 100
31+
});
32+
33+
const findRun = (name) => runs.data.workflow_runs.find(r => r.name === name && r.conclusion === 'success');
34+
35+
const integration = findRun('Integration Tests');
36+
const unit = findRun('Unit Tests');
37+
38+
const ok = Boolean(unit && integration);
39+
core.info(ok ? 'All workflows completed successfully.' : 'Waiting for a remaining workflow to complete.');
40+
41+
core.setOutput('ready', String(ok));
42+
if (ok) {
43+
core.setOutput('unit_run_id', String(unit.id));
44+
core.setOutput('integration_run_id', String(integration.id));
45+
}
46+
47+
- if: ${{ steps.check.outputs.ready == 'true' }}
48+
name: Download artifacts from Integration Tests run
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: coverage-integration-clover
52+
github-token: ${{ secrets.GITHUB_TOKEN }}
53+
run-id: ${{ steps.check.outputs.integration_run_id }}
54+
path: integration-coverage
55+
56+
- if: ${{ steps.check.outputs.ready == 'true' }}
57+
name: Download artifacts from Unit Tests run
58+
uses: actions/download-artifact@v4
59+
with:
60+
name: coverage-unit-clover
61+
github-token: ${{ secrets.GITHUB_TOKEN }}
62+
run-id: ${{ steps.check.outputs.unit_run_id }}
63+
path: unit-coverage
64+
65+
- if: ${{ steps.check.outputs.ready == 'true' }}
66+
name: Merge Clover reports
67+
uses: danielpalme/ReportGenerator-GitHub-Action@v5
68+
with:
69+
reports: |
70+
unit-coverage/clover.xml;
71+
integration-coverage/clover.xml
72+
targetdir: merged-coverage
73+
reporttypes: Clover
74+
75+
- if: ${{ steps.check.outputs.ready == 'true' }}
76+
name: Upload merged coverage to Coveralls
77+
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
78+
with:
79+
github-token: ${{ secrets.GITHUB_TOKEN }}
80+
file: ./merged-coverage/Clover.xml
81+
fail-on-error: false

.github/workflows/integration-tests.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,11 @@ jobs:
124124
POSTGRES_USER: postgres
125125
POSTGRES_PASSWORD: postgres
126126

127-
- name: Upload coverage results to Coveralls
127+
- name: Upload integration coverage artifact
128128
if: matrix.calculate-code-coverage == true
129-
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
129+
uses: actions/upload-artifact@v4
130130
with:
131-
github-token: ${{ secrets.GITHUB_TOKEN }}
132-
file: ./var/logs/test-coverage/integration/clover.xml
133-
parallel: true
134-
flag-name: "Integration"
135-
fail-on-error: false
131+
name: coverage-integration-clover
132+
path: ./var/logs/test-coverage/integration/clover.xml
133+
if-no-files-found: error
134+
retention-days: 7

.github/workflows/unit-tests.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,11 @@ jobs:
107107
- name: Run unit test suite
108108
run: composer run-unit-tests
109109

110-
- name: Upload coverage results to Coveralls
110+
- name: Upload unit coverage artifact
111111
if: matrix.calculate-code-coverage == true
112-
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
112+
uses: actions/upload-artifact@v4
113113
with:
114-
github-token: ${{ secrets.GITHUB_TOKEN }}
115-
file: ./var/logs/test-coverage/unit/clover.xml
116-
parallel: true
117-
flag-name: "Unit"
118-
fail-on-error: false
114+
name: coverage-unit-clover
115+
path: ./var/logs/test-coverage/unit/clover.xml
116+
if-no-files-found: error
117+
retention-days: 7

0 commit comments

Comments
 (0)