diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b76e45851..da4a6345f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,8 @@ on: branches: [main] concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + # Re-runs retain their original SHA; only checks of the same revision may supersede each other. + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.sha }} cancel-in-progress: true permissions: diff --git a/tests/scripts/test_ci_workflows.py b/tests/scripts/test_ci_workflows.py index f1223595b..1d54783d8 100644 --- a/tests/scripts/test_ci_workflows.py +++ b/tests/scripts/test_ci_workflows.py @@ -42,6 +42,12 @@ def test_accepted_handoff_uses_the_producer_id_and_requires_native_success(): assert "name" not in download["with"] +def test_ci_runs_for_distinct_revisions_do_not_cancel_each_other(): + concurrency = workflow("ci.yml")["concurrency"] + assert concurrency["group"] == "${{ github.workflow }}-${{ github.ref }}-${{ github.sha }}" + assert concurrency["cancel-in-progress"] == "true" + + def test_windows_installer_matrix_has_an_independent_required_job(): jobs = workflow("ci.yml")["jobs"] installer = jobs["windows_installers"]