diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 2a8d0582..32acbca3 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -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" diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b6666a95..5ffd4fe2 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -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 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index ac1df675..7b05da87 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -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