Skip to content

Commit d4f6794

Browse files
chore: change artefacts upload strategy for Coveralls (#429)
1 parent d97caae commit d4f6794

File tree

3 files changed

+37
-35
lines changed

3 files changed

+37
-35
lines changed

.github/workflows/coverage.yml

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,43 @@
11
name: Coverage
22

33
on:
4-
workflow_run:
5-
workflows: ["Integration Tests", "Unit Tests"]
6-
types: [completed]
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '.github/actions/release-please/**'
9+
pull_request:
10+
branches:
11+
- main
12+
13+
permissions:
14+
contents: read
15+
checks: read
16+
actions: read
717

818
jobs:
9-
finalize:
19+
wait-for-tests-worflows-before-upload:
1020
runs-on: ubuntu-latest
11-
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_sha == github.sha }}
12-
# Needed for listWorkflowRunsForRepo and safe defaults for token scope
13-
permissions:
14-
actions: read
15-
contents: read
16-
statuses: write
17-
# Prevent multiple concurrent finalizers for the same commit
18-
concurrency:
19-
group: coverage-${{ github.event.workflow_run.head_sha }}
20-
cancel-in-progress: true
2121
steps:
22-
- id: check
23-
uses: actions/github-script@v7
22+
- name: Wait for Unit and Integration jobs
23+
uses: kachick/wait-other-jobs@755be1ff093bd2a6a82a24bfc50ef4d9fe491a59 # v3.8.1
2424
with:
25-
script: |
26-
const workflows = await github.rest.actions.listWorkflowRunsForRepo({
27-
owner: context.repo.owner,
28-
repo: context.repo.repo,
29-
head_sha: context.payload.workflow_run.head_sha,
30-
status: 'completed',
31-
per_page: 100
32-
});
33-
34-
const bothComplete = ['Integration Tests', 'Unit Tests'].every(name =>
35-
workflows.data.workflow_runs.some(
36-
run => run.name === name && run.conclusion === 'success'
37-
)
38-
);
39-
40-
core.info(bothComplete ? 'Both workflows completed successfully.' : 'Waiting for other workflow to complete.');
41-
core.setOutput('ready', String(bothComplete));
25+
skip-same-workflow: 'true'
26+
warmup-delay: 'PT2M'
27+
retry-method: 'equal_intervals'
28+
wait-list: |
29+
[
30+
{"workflowFile": "integration-tests.yml"},
31+
{"workflowFile": "unit-tests.yml"}
32+
]
33+
timeout-minutes: 20
4234

43-
- if: ${{ steps.check.outputs.ready == 'true' }}
44-
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b
35+
- name: Finalize Coveralls parallel build
36+
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
37+
env:
38+
COVERALLS_SERVICE_NAME: github
39+
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}
4540
with:
4641
github-token: ${{ secrets.GITHUB_TOKEN }}
4742
parallel-finished: true
43+
carryforward: "Integration,Unit"

.github/workflows/integration-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ jobs:
127127
- name: Upload coverage results to Coveralls
128128
if: matrix.calculate-code-coverage == true
129129
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
130+
env:
131+
COVERALLS_SERVICE_NAME: github
132+
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}
130133
with:
131134
github-token: ${{ secrets.GITHUB_TOKEN }}
132135
file: ./var/logs/test-coverage/integration/clover.xml

.github/workflows/unit-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ jobs:
110110
- name: Upload coverage results to Coveralls
111111
if: matrix.calculate-code-coverage == true
112112
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
113+
env:
114+
COVERALLS_SERVICE_NAME: github
115+
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}
113116
with:
114117
github-token: ${{ secrets.GITHUB_TOKEN }}
115118
file: ./var/logs/test-coverage/unit/clover.xml

0 commit comments

Comments
 (0)