Skip to content

Commit

Permalink
GH Actions/test: allow concurrency for build against "main" branches
Browse files Browse the repository at this point in the history
The `concurrency` setting will cancel running workflows is a new push to the same branch is seen. This is useful to prevent unnecessary workflow runs (as the previous push was superseded, so the outcome is no longer relevant).

However, for the "main" branches (`master` and `4.0`), this workflow cancelling means that if multiple PRs are merged in succession, only the code coverage for the _last_ merge is recorded in Coveralls as the workflow runs on `master` for the previous merges will have been cancelled.

While in practice, it's not a biggie, it does make it more difficult to identify which commit/merge added or decreased code coverage.

With this in mind, I'm making a small change to the `concurrency` setting for the `test` workflow only to allow those to always finish when the workflow is run for the "main" branches.
  • Loading branch information
jrfnl committed Nov 22, 2024
1 parent a480170 commit 9ed4ae8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ on:
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
# Cancels all previous workflow runs for the same branch that have not yet completed,
# but don't cancel when it's one of the "main" branches as that prevents
# accurate monitoring of code coverage.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref_name != 'master' && github.ref_name != '4.0' }}

jobs:
build:
Expand Down

0 comments on commit 9ed4ae8

Please sign in to comment.