From 0a6a76a0c425e710545283fe06c15e6e5d28db41 Mon Sep 17 00:00:00 2001 From: FredApps Date: Tue, 10 Nov 2026 11:10:43 +0100 Subject: [PATCH 1/2] ci: test each change once, cancel superseded PR runs, cache from main --- .github/workflows/gdi.yml | 7 ++++++- .github/workflows/test.yml | 21 ++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/gdi.yml b/.github/workflows/gdi.yml index 04bfeac..621c21a 100644 --- a/.github/workflows/gdi.yml +++ b/.github/workflows/gdi.yml @@ -8,6 +8,10 @@ on: paths: ['crates/gdi/**', '.github/workflows/gdi.yml'] permissions: contents: read +concurrency: + group: gdi-${{ github.ref }} + # A newer push to a pull request replaces its older run; runs on main always finish. + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: gdi: strategy: @@ -15,8 +19,9 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} + timeout-minutes: 30 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f56a165..28961d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,12 +1,20 @@ name: Test on: + # Pull requests are tested by the pull_request event; pushing to every branch as well ran the + # same Windows feature matrix twice for each branch in this repository. push: - branches: - - "**" + branches: [main] pull_request: - branches: - - "**" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: test-${{ github.ref }} + # A newer push to a pull request replaces its older run; runs on main always finish. + cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: CARGO_TERM_COLOR: always @@ -15,12 +23,15 @@ jobs: test: runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Setup Rust toolchain uses: moonrepo/setup-rust@v1 with: channel: stable bins: cargo-hack + # Save the dependency cache from main only; pull requests restore it. Each pull request + # used to save its own 0.5-1 GB copy that no other branch can restore. + cache-base: main env: GITHUB_TOKEN: ${{ github.token }} - name: Test From dc32aa7ad8d6e598c8658dfbb83dd9bc4078a900 Mon Sep 17 00:00:00 2001 From: FredApps Date: Tue, 10 Nov 2026 14:51:54 +0100 Subject: [PATCH 2/2] ci: give runs outside pull requests their own concurrency group --- .github/workflows/gdi.yml | 5 +++-- .github/workflows/test.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gdi.yml b/.github/workflows/gdi.yml index 621c21a..4d02173 100644 --- a/.github/workflows/gdi.yml +++ b/.github/workflows/gdi.yml @@ -9,8 +9,9 @@ on: permissions: contents: read concurrency: - group: gdi-${{ github.ref }} - # A newer push to a pull request replaces its older run; runs on main always finish. + # Pull requests share one group per branch, so a newer push cancels the older run. Every other + # run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued. + group: gdi-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: gdi: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 28961d3..cda2f40 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,8 +12,9 @@ permissions: contents: read concurrency: - group: test-${{ github.ref }} - # A newer push to a pull request replaces its older run; runs on main always finish. + # Pull requests share one group per branch, so a newer push cancels the older run. Every other + # run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued. + group: test-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: