Skip to content

Commit

Permalink
Cancel duplicate CI runs on non-main branches (#1996)
Browse files Browse the repository at this point in the history
With this change, if someone pushes a new change to a branch, the
previous CI runs will be cancelled in favour of running again on
the latest change. This should relieve some pressure on our CI
runners.

Also, I included a small change to avoid spurious failures from
the "Archive closed PR branch" workflow.
  • Loading branch information
JamesHinshelwood authored Dec 11, 2024
1 parent 738b1ae commit 59f299a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/base_benchmarks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ on:
push:
branches: main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
benchmark_base_branch:
name: Continuous Benchmarking
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
types:
- checks_requested

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
CARGO_TERM_COLOR: always
# Run a decent number of samples for our randomized tests
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr_benchmarks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ on:
pull_request:
types: [opened, reopened, edited, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
benchmark_pr_branch:
name: Continuous Benchmarking PRs
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr_benchmarks_closed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: bencherdev/bencher@main
- name: Archive closed PR branch
continue-on-error: true # This will fail if the branch did not exist in bencher. This is fine.
run: |
bencher archive \
--project zq2 \
Expand Down

0 comments on commit 59f299a

Please sign in to comment.