Skip to content

Commit

Permalink
Refactor GitHub Actions workflows to use a dynamic concurrency group
Browse files Browse the repository at this point in the history
This commit refactors the GitHub Actions workflows to use a dynamic concurrency group based on the workflow and branch name. The previous implementation used a static format for the concurrency group, which caused issues when merging changes quickly. Now, each workflow will have its own unique concurrency group based on the workflow name and branch name. This change improves build completion and makes it easier to identify breaking points in the CI pipeline.
  • Loading branch information
acgetchell committed Nov 7, 2023
1 parent 8605c78 commit f5d30af
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 31 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: clang-format Check
on: [push, pull_request]

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
jobs:
formatting-check:
name: Formatting Check
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/codecov-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: CodeCov
on: [push, pull_request, workflow_dispatch]

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
codecov:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ on:
workflow_dispatch:

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/linux-clang-pkgx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: Linux Clang with pkgx
on: [push, pull_request, workflow_dispatch]

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/linux-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: Linux Clang
on: [push, pull_request, workflow_dispatch]

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/linux-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: Linux GCC
on: [push, pull_request, workflow_dispatch]

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: macOS
on: [push, pull_request, workflow_dispatch]

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: SonarCloud
on: [push, pull_request, workflow_dispatch]

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
sonarcloud:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/windows-msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: Windows
on: [workflow_dispatch]

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/windows-pkgx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: Windows pkgx
on: [workflow_dispatch]

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
Expand Down

0 comments on commit f5d30af

Please sign in to comment.