ci: cancel superseded main runs; a scheduled full run saves the caches

Pushes to main cancel the Workspace run they supersede, as pull requests
already do; the newest push's run tests everything before it. On 16 Nov main
had 144 pushes, each a three-OS run that could not be cancelled, which is much
of what fills the org's macOS runners. Release tags, manual runs and a new
scheduled run every 6 hours keep a group of their own and always finish, and the
scheduled run saves the caches (the gate already saves on scheduled runs of the
default branch). scripts/test-workspace-concurrency.py checks the new policy.

The per-crate workflows, which no longer save caches, cancel superseded runs on
every branch, main included.
This commit is contained in:
aiongg committed 2026-11-17 19:09:20 +00:00
1 parent a1398a3b61
commit c0421c7fc6
23 files changed
+129 -112

No files matched your search

+10 -6
View File
@@ -6,17 +6,21 @@ on:
tags: ["v*"]
pull_request:
workflow_dispatch:
# A full run on main every 6 hours that is never cancelled, so the caches are saved while pushes
# to main cancel each other.
schedule:
- cron: "17 */6 * * *"
permissions:
contents: read
concurrency:
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
# run (push to main, a release tag, a manual run) gets a group of its own: it is neither
# cancelled nor replaced while queued, so a main run always finishes and saves the dependency
# cache, and a release run is never cancelled.
group: workspace-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
# A pull request, and main, each have one group, so a newer push cancels the run it supersedes;
# the newest push's run still tests everything before it. Every other run (a release tag, a
# manual run, the scheduled run) gets a group of its own and is neither cancelled nor replaced
# while queued: a release run always finishes, and the scheduled run saves the caches.
group: workspace-${{ (github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/main') && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/main' }}
jobs:
native: