mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-27 13:17:41 +00:00
CI: next is retired; workflows trigger on main only
next's work goes into main and the branch is retired, so its triggers, the nightly job that started the Workspace and full-test runs on next, and the cache and concurrency rules for next's runs are removed. The Workspace concurrency test checks the policy for main alone.
This commit is contained in:
@@ -3,7 +3,7 @@ name: AI model
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/ai-core/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/ai-core.yml']
|
||||
pull_request:
|
||||
paths: ['crates/ai-core/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/ai-core.yml']
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Atomic file writes
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/atomic/**', 'crates/settings/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/atomic.yml']
|
||||
pull_request:
|
||||
paths: ['crates/atomic/**', 'crates/settings/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/atomic.yml']
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Shared audio
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ["crates/audio/**", "crates/media/**", "crates/media-testkit/**", "scripts/fetch-opus-vectors.sh", "Cargo.toml", "Cargo.lock", ".github/workflows/audio.yml"]
|
||||
pull_request:
|
||||
paths: ["crates/audio/**", "crates/media/**", "crates/media-testkit/**", "scripts/fetch-opus-vectors.sh", "Cargo.toml", "Cargo.lock", ".github/workflows/audio.yml"]
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Colour management
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/cms/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/cms.yml']
|
||||
pull_request:
|
||||
paths: ['crates/cms/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/cms.yml']
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Shared CRW
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ["crates/crw/**", "scripts/fetch-crw-samples.py", "Cargo.toml", "Cargo.lock", ".github/workflows/crw.yml"]
|
||||
pull_request:
|
||||
paths: ["crates/crw/**", "scripts/fetch-crw-samples.py", "Cargo.toml", "Cargo.lock", ".github/workflows/crw.yml"]
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
- uses: step-security/dtolnay-rust-toolchain@v1.0.0
|
||||
with:
|
||||
toolchain: stable
|
||||
# Pull requests restore the entry main or next saved and never write their own: the same
|
||||
# Pull requests restore the entry main saved and never write their own: the same
|
||||
# files saved once per pull request took a share of the 10 GB cache budget.
|
||||
- name: Restore the CC0 sample files
|
||||
id: samples
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Dialogs
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/dialogs/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/dialogs.yml']
|
||||
pull_request:
|
||||
paths: ['crates/dialogs/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/dialogs.yml']
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Craft documents
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/doc/**', 'crates/pcraft-format/**', 'crates/vectorcraft-format/**', 'crates/ecproj-format/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/doc.yml']
|
||||
pull_request:
|
||||
paths: ['crates/doc/**', 'crates/pcraft-format/**', 'crates/vectorcraft-format/**', 'crates/ecproj-format/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/doc.yml']
|
||||
|
||||
@@ -6,7 +6,7 @@ name: Docs
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/docs.yml']
|
||||
pull_request:
|
||||
paths: ['crates/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/docs.yml']
|
||||
|
||||
@@ -3,7 +3,7 @@ name: EffectCraft project format
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/ecproj-format/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/ecproj-format.yml']
|
||||
pull_request:
|
||||
paths: ['crates/ecproj-format/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/ecproj-format.yml']
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Font store
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/font-store/**', 'crates/font-catalog/**', 'crates/atomic/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/font-store.yml']
|
||||
pull_request:
|
||||
paths: ['crates/font-store/**', 'crates/font-catalog/**', 'crates/atomic/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/font-store.yml']
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Shared format crates
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths:
|
||||
- "crates/xml/**"
|
||||
- "crates/mime/**"
|
||||
|
||||
@@ -2,7 +2,7 @@ name: House rules
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths:
|
||||
- AGENTS.md
|
||||
- CLAUDE.md
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Shared JPEG
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ["crates/jpeg/**", "Cargo.toml", "Cargo.lock", ".github/workflows/jpeg.yml"]
|
||||
pull_request:
|
||||
paths: ["crates/jpeg/**", "Cargo.toml", "Cargo.lock", ".github/workflows/jpeg.yml"]
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Keymap
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ["crates/keymap/**", "crates/settings/**", "crates/ui/**", "crates/ui-contract/**", "crates/ui-widgets/**", "crates/ui-panels/**", "crates/ui-canvas/**", "crates/ui-patterns/**", "crates/ui-shell/**", "crates/i18n/**", "Cargo.toml", "Cargo.lock", ".github/workflows/keymap.yml"]
|
||||
pull_request:
|
||||
paths: ["crates/keymap/**", "crates/settings/**", "crates/ui/**", "crates/ui-contract/**", "crates/ui-widgets/**", "crates/ui-panels/**", "crates/ui-canvas/**", "crates/ui-patterns/**", "crates/ui-shell/**", "crates/i18n/**", "Cargo.toml", "Cargo.lock", ".github/workflows/keymap.yml"]
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Shared media
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ["crates/media/**", "crates/media-testkit/**", "Cargo.toml", "Cargo.lock", ".github/workflows/media.yml"]
|
||||
pull_request:
|
||||
paths: ["crates/media/**", "crates/media-testkit/**", "Cargo.toml", "Cargo.lock", ".github/workflows/media.yml"]
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Menu
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ["crates/menu/**", "crates/keymap/**", "crates/quit/**", "Cargo.toml", "Cargo.lock", ".github/workflows/menu.yml"]
|
||||
pull_request:
|
||||
paths: ["crates/menu/**", "crates/keymap/**", "crates/quit/**", "Cargo.toml", "Cargo.lock", ".github/workflows/menu.yml"]
|
||||
|
||||
@@ -33,30 +33,3 @@ jobs:
|
||||
cache-key-files: scripts/ci-test-inputs.sh
|
||||
# The gate's build (the same targets and profile overrides), with every test at its full count.
|
||||
command: bash scripts/ci-workspace-tests.sh full
|
||||
|
||||
# The scheduled run is main's; this starts the full tests above on next too, where the gate
|
||||
# runs the same fractions. It also starts one Workspace run on next a day that nothing cancels
|
||||
# (pull requests run the Linux legs only, and pushes to next cancel each other's runs): next's
|
||||
# macOS and Windows legs then run in full at least once a day, and its Linux leg builds from
|
||||
# source and saves next's own workspace-crates cache entry, which pull requests into next
|
||||
# restore. Main gets the same from workspace.yml's own scheduled runs. The only job here with
|
||||
# `actions: write`; it checks out and runs nothing from the repository.
|
||||
workspace-next:
|
||||
name: Workspace on next
|
||||
if: github.event_name == 'schedule'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
actions: write
|
||||
steps:
|
||||
- name: Harden runner
|
||||
uses: step-security/harden-runner@v2.22.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
- name: Start the Workspace workflow and these full tests on next
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
gh workflow run workspace.yml --repo "$REPO" --ref next
|
||||
gh workflow run nightly.yml --repo "$REPO" --ref next
|
||||
|
||||
@@ -3,7 +3,7 @@ name: PhotoCraft format
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/pcraft-format/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/pcraft-format.yml']
|
||||
pull_request:
|
||||
paths: ['crates/pcraft-format/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/pcraft-format.yml']
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Shared PDF
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ["crates/pdf/**", "crates/plate-test/**", "crates/prepress/**", "crates/cms/**", "vendor/hayro*/**", "vendor/krilla/**", "vendor/linesweeper/**", "vendor/vello_common/**", "vendor/vello_cpu/**", "scripts/test-pdf-backends.sh", "scripts/*fetch-pdf-test-fonts.py", "Cargo.toml", "Cargo.lock", ".github/workflows/pdf.yml"]
|
||||
pull_request:
|
||||
paths: ["crates/pdf/**", "crates/plate-test/**", "crates/prepress/**", "crates/cms/**", "vendor/hayro*/**", "vendor/krilla/**", "vendor/linesweeper/**", "vendor/vello_common/**", "vendor/vello_cpu/**", "scripts/test-pdf-backends.sh", "scripts/*fetch-pdf-test-fonts.py", "Cargo.toml", "Cargo.lock", ".github/workflows/pdf.yml"]
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Proofing
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ["crates/proof/**", "Cargo.toml", "Cargo.lock", ".github/workflows/proof.yml"]
|
||||
pull_request:
|
||||
paths: ["crates/proof/**", "Cargo.toml", "Cargo.lock", ".github/workflows/proof.yml"]
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Suite themes
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/theme/**', 'crates/theme-store/**', 'crates/atomic/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/theme.yml']
|
||||
pull_request:
|
||||
paths: ['crates/theme/**', 'crates/theme-store/**', 'crates/atomic/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/theme.yml']
|
||||
|
||||
@@ -3,7 +3,7 @@ name: App updates
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/update/**', 'Cargo.toml', 'Cargo.lock', 'rustfmt.toml', 'clippy.toml', '.github/workflows/update.yml']
|
||||
pull_request:
|
||||
paths: ['crates/update/**', 'Cargo.toml', 'Cargo.lock', 'rustfmt.toml', 'clippy.toml', '.github/workflows/update.yml']
|
||||
|
||||
@@ -3,7 +3,7 @@ name: VectorCraft format
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/vectorcraft-format/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/vectorcraft-format.yml']
|
||||
pull_request:
|
||||
paths: ['crates/vectorcraft-format/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/vectorcraft-format.yml']
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Shared video
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ["crates/video/**", "crates/media/**", "crates/media-testkit/**", "Cargo.toml", "Cargo.lock", ".github/workflows/video.yml"]
|
||||
pull_request:
|
||||
paths: ["crates/video/**", "crates/media/**", "crates/media-testkit/**", "Cargo.toml", "Cargo.lock", ".github/workflows/video.yml"]
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Web API (page command API)
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/web-api/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/web-api.yml']
|
||||
pull_request:
|
||||
paths: ['crates/web-api/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/web-api.yml']
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Shared web host
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ["crates/web-host/**", "Cargo.toml", "Cargo.lock", ".github/workflows/web-host.yml"]
|
||||
pull_request:
|
||||
paths: ["crates/web-host/**", "Cargo.toml", "Cargo.lock", ".github/workflows/web-host.yml"]
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Window decorations
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
paths: ['crates/window/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/window.yml']
|
||||
pull_request:
|
||||
paths: ['crates/window/**', 'Cargo.toml', 'Cargo.lock', '.github/workflows/window.yml']
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Workspace
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next]
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
@@ -16,13 +16,12 @@ permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
# A pull request, main and next 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, nightly.yml's run on next) gets a group of its own and is
|
||||
# neither cancelled nor replaced while queued: a release run always finishes, the scheduled run
|
||||
# saves the caches, and next gets one complete macOS and Windows run a day.
|
||||
group: workspace-${{ (github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'push' && github.ref == 'refs/heads/next') && github.ref || github.run_id }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'push' && github.ref == 'refs/heads/next' }}
|
||||
# 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:
|
||||
# Whether this run needs the macOS and Windows legs, and which tests every leg runs
|
||||
@@ -71,7 +70,7 @@ jobs:
|
||||
# The macOS and Windows legs cache dependencies only, so `deps-profile` hashes only the
|
||||
# settings that reach a dependency: `[profile.dev]` and `[profile.dev.package."*"]`. Every
|
||||
# other override names a workspace crate (scripts/test-workspace-tests.py), so changing one
|
||||
# keeps those entries, and next's runs restore main's.
|
||||
# keeps those entries.
|
||||
- uses: actions/checkout@v7.0.1
|
||||
if: github.event_name != 'pull_request'
|
||||
with:
|
||||
@@ -104,13 +103,10 @@ jobs:
|
||||
# The Linux leg keeps the compiled workspace crates between runs (`cache-workspace-crates`): each
|
||||
# main run saves a rolling cache entry of its own, every run restores the newest one, and Cargo
|
||||
# rebuilds only the crates a change reaches. `cache-prune` keeps the newest entry. The midnight
|
||||
# scheduled run builds from source (`cold-build`) and starts the entry afresh. next has an entry
|
||||
# of its own, since main's is built from different code and lockfile and a pull request into next
|
||||
# rebuilt nearly everything from it (15.5 minutes): nightly.yml's daily manual run on next builds
|
||||
# from source and saves it (`cache-save-on-dispatch`), and pull requests into next restore it
|
||||
# before main's. The macOS and Windows legs keep a dependency-only entry: their workspace crates
|
||||
# would not fit the 10 GB cache budget beside Linux's. The lint legs keep no cache
|
||||
# (`lint-cache: false`) for the same reason; a cold lint leg is still shorter than its gate leg.
|
||||
# scheduled run builds from source (`cold-build`) and starts the entry afresh. The macOS and
|
||||
# Windows legs keep a dependency-only entry: their workspace crates would not fit the 10 GB cache
|
||||
# budget beside Linux's. The lint legs keep no cache (`lint-cache: false`) for the same reason; a
|
||||
# cold lint leg is still shorter than its gate leg.
|
||||
native:
|
||||
name: Workspace
|
||||
needs: platforms
|
||||
@@ -118,9 +114,8 @@ jobs:
|
||||
with:
|
||||
os: '["ubuntu-latest"]'
|
||||
cache-workspace-crates: true
|
||||
cache-save-on-dispatch: true
|
||||
cache-version: &cache-version v2-${{ needs.platforms.outputs.profile }}
|
||||
cold-build: ${{ github.event.schedule == '17 0 * * *' || github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/next' }}
|
||||
cold-build: ${{ github.event.schedule == '17 0 * * *' }}
|
||||
lint-cache: false
|
||||
# The vendored crates are on the workspace `exclude` list and craft-pdf's read-only contract is a
|
||||
# workspace of its own (pdf.yml tests it), so unreached-rs has no module tree for them.
|
||||
@@ -182,7 +177,7 @@ jobs:
|
||||
|
||||
# The macOS and Windows legs, with the Linux leg's inputs. They take 1.5-2 hours against the Linux
|
||||
# leg's 15-40 minutes, so a pull request does not wait for them: they run after the merge, on
|
||||
# every push to main and next, on main's scheduled runs and on nightly.yml's daily run on next.
|
||||
# every push to main and on main's scheduled runs.
|
||||
# A pull request that needs them before it merges gets the full-ci label.
|
||||
native-platforms:
|
||||
name: Workspace
|
||||
@@ -192,7 +187,7 @@ jobs:
|
||||
with:
|
||||
os: '["windows-latest","macos-latest"]'
|
||||
lint-cache: false
|
||||
# Named by the dependency settings alone (`deps-profile`), so next restores main's entries.
|
||||
# Named by the dependency settings alone (`deps-profile`).
|
||||
cache-version: v2-${{ needs.platforms.outputs.deps-profile }}
|
||||
timeout-minutes: *timeout
|
||||
tools: *tools
|
||||
@@ -212,15 +207,14 @@ jobs:
|
||||
lint-command: *lint
|
||||
command: *command
|
||||
|
||||
# Each main run's Linux leg saves a rolling cache entry of its own (`cache-workspace-crates`), as
|
||||
# does the daily manual run on next, and every run restores only the newest. This deletes the
|
||||
# older ones of the run's branch as soon as the Linux leg is done, instead of leaving them to the
|
||||
# 10 GB budget's eviction, which would evict other entries too. The only job with
|
||||
# `actions: write`; it checks out and runs nothing from the repository.
|
||||
# Each main run's Linux leg saves a rolling cache entry of its own (`cache-workspace-crates`), and
|
||||
# every run restores only the newest. This deletes the older ones as soon as the Linux leg is
|
||||
# done, instead of leaving them to the 10 GB budget's eviction, which would evict other entries
|
||||
# too. The only job with `actions: write`; it checks out and runs nothing from the repository.
|
||||
cache-prune:
|
||||
name: cache prune
|
||||
needs: native
|
||||
if: ${{ !cancelled() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next') }}
|
||||
if: ${{ !cancelled() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
@@ -234,11 +228,10 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPO: ${{ github.repository }}
|
||||
REF: ${{ github.ref }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# `<version>-rust-<profile>-<job>-crates-<os>-<arch>-<run>-<attempt>-...`, newest first.
|
||||
gh cache list --repo "$REPO" --ref "$REF" --limit 100 --sort created_at --order desc --json id,key \
|
||||
gh cache list --repo "$REPO" --ref refs/heads/main --limit 100 --sort created_at --order desc --json id,key \
|
||||
--jq '.[] | "\(.id) \(.key)"' > "$RUNNER_TEMP/caches"
|
||||
declare -A kept
|
||||
while read -r id key; do
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check the Workspace workflow's cancellation policy: pull requests and pushes to main or next
|
||||
cancel the run they supersede; release tags, manual runs and scheduled runs are never cancelled.
|
||||
"""Check the Workspace workflow's cancellation policy: pull requests and pushes to main cancel
|
||||
the run they supersede; release tags, manual runs and scheduled runs are never cancelled.
|
||||
|
||||
The policy is the top-level `concurrency` block of .github/workflows/workspace.yml. This script
|
||||
reads those fields, requires the documented expression shapes, and checks which group each event
|
||||
@@ -32,7 +32,6 @@ PULL_REQUEST, PUSH, DISPATCH, SCHEDULE = "pull_request", "push", "workflow_dispa
|
||||
SUPERSEDED = (
|
||||
"github.event_name == 'pull_request'"
|
||||
" || github.event_name == 'push' && github.ref == 'refs/heads/main'"
|
||||
" || github.event_name == 'push' && github.ref == 'refs/heads/next'"
|
||||
)
|
||||
GROUP_SHAPE = re.compile(
|
||||
r"(?P<prefix>[A-Za-z0-9._-]+)-\$\{\{\s*\(\s*(?P<condition>[^()]+?)\s*\)\s*"
|
||||
@@ -47,7 +46,7 @@ def normal(expression):
|
||||
|
||||
def superseded(event_name, ref):
|
||||
"""SUPERSEDED, evaluated."""
|
||||
return event_name == PULL_REQUEST or (event_name == PUSH and ref in ("refs/heads/main", "refs/heads/next"))
|
||||
return event_name == PULL_REQUEST or (event_name == PUSH and ref == "refs/heads/main")
|
||||
|
||||
|
||||
def read_concurrency(text):
|
||||
@@ -86,11 +85,10 @@ def other_run(event_name, ref, run_id):
|
||||
return (event_name, ref, run_id)
|
||||
|
||||
|
||||
MAIN, NEXT, TAG = ("refs/heads/main", "refs/heads/next", "refs/tags/v1.2.3")
|
||||
MAIN, TAG = ("refs/heads/main", "refs/tags/v1.2.3")
|
||||
SAME_GROUP = [
|
||||
("a newer commit on the same pull request", pull_request(1316, 43599251877), pull_request(1316, 43600899878)),
|
||||
("two pushes to main", other_run(PUSH, MAIN, 3), other_run(PUSH, MAIN, 4)),
|
||||
("two pushes to next", other_run(PUSH, NEXT, 20), other_run(PUSH, NEXT, 21)),
|
||||
]
|
||||
DIFFERENT_GROUPS = [
|
||||
("two pull requests", pull_request(1316, 1), pull_request(1317, 1)),
|
||||
@@ -101,15 +99,11 @@ DIFFERENT_GROUPS = [
|
||||
("a main push and a scheduled run", other_run(PUSH, MAIN, 17), other_run(SCHEDULE, MAIN, 17)),
|
||||
("a main push and a manual run of main", other_run(PUSH, MAIN, 18), other_run(DISPATCH, MAIN, 18)),
|
||||
("a main push and a pull request", other_run(PUSH, MAIN, 9), pull_request(1316, 9)),
|
||||
("a main push and a next push", other_run(PUSH, MAIN, 22), other_run(PUSH, NEXT, 22)),
|
||||
("a next push and the nightly manual run of next", other_run(PUSH, NEXT, 23), other_run(DISPATCH, NEXT, 23)),
|
||||
("a release tag and a pull request", other_run(PUSH, TAG, 10), pull_request(1316, 10)),
|
||||
]
|
||||
CANCELLATION = [
|
||||
("a push supersedes the previous run of its pull request", pull_request(1316, 11), True),
|
||||
("a push to main supersedes the previous main run", other_run(PUSH, MAIN, 12), True),
|
||||
("a push to next supersedes the previous next run", other_run(PUSH, NEXT, 24), True),
|
||||
("the nightly manual run of next is never cancelled", other_run(DISPATCH, NEXT, 25), False),
|
||||
("a release tag run is never cancelled", other_run(PUSH, TAG, 13), False),
|
||||
("a manual run is never cancelled", other_run(DISPATCH, MAIN, 14), False),
|
||||
("the scheduled run that saves the caches is never cancelled", other_run(SCHEDULE, MAIN, 19), False),
|
||||
@@ -158,7 +152,7 @@ class ConcurrencyTests(unittest.TestCase):
|
||||
with self.subTest(description):
|
||||
self.assertNotEqual(self.group(*first), self.group(*second), description)
|
||||
|
||||
def test_only_pull_requests_and_main_and_next_pushes_cancel(self):
|
||||
def test_only_pull_requests_and_main_pushes_cancel(self):
|
||||
for description, context, expected in CANCELLATION:
|
||||
with self.subTest(description):
|
||||
self.assertEqual(self.cancels(context[0], context[1]), expected, description)
|
||||
|
||||
@@ -318,7 +318,7 @@ class WorkspaceTests(unittest.TestCase):
|
||||
self.assertIn("test-shards: ${{ needs.platforms.outputs.audit == 'true' && 3 || 0 }}", source)
|
||||
# The Linux leg's entry, which keeps workspace crates, is named after every profile override;
|
||||
# the macOS and Windows legs' dependency-only entries after the settings that reach a
|
||||
# dependency, so next restores main's (test_profile_overrides_name_only_workspace_members).
|
||||
# dependency (test_profile_overrides_name_only_workspace_members).
|
||||
self.assertIn("cache-version: &cache-version v2-${{ needs.platforms.outputs.profile }}\n", source)
|
||||
self.assertIn(" cache-version: v2-${{ needs.platforms.outputs.deps-profile }}\n", source)
|
||||
self.assertIn(" deps-profile: ${{ steps.audit.outputs.deps-profile }}\n", source)
|
||||
|
||||
Reference in New Issue
Block a user