Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 31 additions & 35 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@
name: Coverage

on:
workflow_run:
workflows: ["Integration Tests", "Unit Tests"]
types: [completed]
push:
branches:
- main
paths-ignore:
- '.github/actions/release-please/**'
pull_request:
branches:
- main

permissions:
contents: read
checks: read
actions: read

jobs:
finalize:
wait-for-tests-worflows-before-upload:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_sha == github.sha }}
# Needed for listWorkflowRunsForRepo and safe defaults for token scope
permissions:
actions: read
contents: read
statuses: write
# Prevent multiple concurrent finalizers for the same commit
concurrency:
group: coverage-${{ github.event.workflow_run.head_sha }}
cancel-in-progress: true
steps:
- id: check
uses: actions/github-script@v7
- name: Wait for Unit and Integration jobs
uses: kachick/wait-other-jobs@755be1ff093bd2a6a82a24bfc50ef4d9fe491a59 # v3.8.1
with:
script: |
const workflows = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.payload.workflow_run.head_sha,
status: 'completed',
per_page: 100
});

const bothComplete = ['Integration Tests', 'Unit Tests'].every(name =>
workflows.data.workflow_runs.some(
run => run.name === name && run.conclusion === 'success'
)
);

core.info(bothComplete ? 'Both workflows completed successfully.' : 'Waiting for other workflow to complete.');
core.setOutput('ready', String(bothComplete));
skip-same-workflow: 'true'
warmup-delay: 'PT2M'
retry-method: 'equal_intervals'
wait-list: |
[
{"workflowFile": "integration-tests.yml"},
{"workflowFile": "unit-tests.yml"}
]
timeout-minutes: 20

- if: ${{ steps.check.outputs.ready == 'true' }}
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b
- name: Finalize Coveralls parallel build
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
env:
COVERALLS_SERVICE_NAME: github
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
carryforward: "Integration,Unit"
3 changes: 3 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ jobs:
- name: Upload coverage results to Coveralls
if: matrix.calculate-code-coverage == true
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
env:
COVERALLS_SERVICE_NAME: github
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./var/logs/test-coverage/integration/clover.xml
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ jobs:
- name: Upload coverage results to Coveralls
if: matrix.calculate-code-coverage == true
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
env:
COVERALLS_SERVICE_NAME: github
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./var/logs/test-coverage/unit/clover.xml
Expand Down
Loading