mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 16:53:05 +00:00
Merge pull request #2113 from aiongg/ci-speed-b
ci: lint leg, cached corpora, platform legs only when needed, superseded main runs cancelled
This commit is contained in:
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: ai-core-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: ai-core-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
# fmt, clippy and the tests run in the Workspace gate on every OS; this checks what it does not.
|
# fmt, clippy and the tests run in the Workspace gate on every OS; this checks what it does not.
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: atomic-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: atomic-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
# fmt, clippy and the tests run in the Workspace gate on every OS; this runs what it does not.
|
# fmt, clippy and the tests run in the Workspace gate on every OS; this runs what it does not.
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -17,11 +17,10 @@ env:
|
|||||||
PROPTEST_CASES: "64"
|
PROPTEST_CASES: "64"
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it
|
# too, since the newest run checks everything before it.
|
||||||
# always gets to save the cache.
|
group: shared-audio-${{ github.ref }}
|
||||||
group: shared-audio-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
cancel-in-progress: true
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ on:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
|
# too, since the newest run checks everything before it.
|
||||||
|
group: cms-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
# clippy and the debug tests run in the Workspace gate; this runs the release build of the tests.
|
# clippy and the debug tests run in the Workspace gate; this runs the release build of the tests.
|
||||||
jobs:
|
jobs:
|
||||||
cms:
|
cms:
|
||||||
|
|||||||
@@ -12,11 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it
|
# too, since the newest run checks everything before it.
|
||||||
# always gets to save the cache.
|
group: shared-crw-${{ github.ref }}
|
||||||
group: shared-crw-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
cancel-in-progress: true
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
# fmt, clippy and the tests run in the Workspace gate on every OS; this checks what it does not.
|
# fmt, clippy and the tests run in the Workspace gate on every OS; this checks what it does not.
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: dialogs-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: dialogs-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
dialogs:
|
dialogs:
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: doc-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: doc-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
# fmt, clippy and the tests run in the Workspace gate on every OS; this checks what it does not.
|
# fmt, clippy and the tests run in the Workspace gate on every OS; this checks what it does not.
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: ecproj-format-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: ecproj-format-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
# fmt, clippy and the tests run in the Workspace gate on every OS; this checks what it does not.
|
# fmt, clippy and the tests run in the Workspace gate on every OS; this checks what it does not.
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: font-store-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: font-store-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
# fmt, clippy and the tests run in the Workspace gate on every OS; this checks what it does not.
|
# fmt, clippy and the tests run in the Workspace gate on every OS; this checks what it does not.
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -42,11 +42,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it
|
# too, since the newest run checks everything before it.
|
||||||
# always gets to save the cache.
|
group: shared-formats-${{ github.ref }}
|
||||||
group: shared-formats-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
cancel-in-progress: true
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
|
|||||||
@@ -12,15 +12,15 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it
|
# too, since the newest run checks everything before it.
|
||||||
# always gets to save the cache.
|
group: shared-jpeg-${{ github.ref }}
|
||||||
group: shared-jpeg-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
cancel-in-progress: true
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
timeout-minutes: 10
|
# Uncached: the wasm check builds its dependencies on every run (about 10 minutes with setup).
|
||||||
|
timeout-minutes: 20
|
||||||
# fmt, clippy and the tests run in the Workspace gate on every OS.
|
# fmt, clippy and the tests run in the Workspace gate on every OS.
|
||||||
name: JPEG WASM
|
name: JPEG WASM
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -12,11 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it
|
# too, since the newest run checks everything before it.
|
||||||
# always gets to save the cache.
|
group: keymap-${{ github.ref }}
|
||||||
group: keymap-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
cancel-in-progress: true
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linux:
|
linux:
|
||||||
|
|||||||
@@ -17,11 +17,10 @@ env:
|
|||||||
PROPTEST_CASES: "64"
|
PROPTEST_CASES: "64"
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it
|
# too, since the newest run checks everything before it.
|
||||||
# always gets to save the cache.
|
group: shared-media-${{ github.ref }}
|
||||||
group: shared-media-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
cancel-in-progress: true
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
|
|||||||
@@ -28,4 +28,7 @@ jobs:
|
|||||||
linux-env: WGPU_BACKEND=vulkan
|
linux-env: WGPU_BACKEND=vulkan
|
||||||
env: CRAFT_PRINT_REQUIRE_QUEUE=0
|
env: CRAFT_PRINT_REQUIRE_QUEUE=0
|
||||||
setup-command: bash scripts/ci-test-inputs.sh
|
setup-command: bash scripts/ci-test-inputs.sh
|
||||||
|
cache-paths: .test-inputs/photocraft/corpus
|
||||||
|
cache-key: photocraft-corpus
|
||||||
|
cache-key-files: scripts/ci-test-inputs.sh
|
||||||
command: cargo nextest run --workspace --all-features --locked --profile ci
|
command: cargo nextest run --workspace --all-features --locked --profile ci
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: pcraft-format-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: pcraft-format-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
# fmt, clippy and the tests run in the Workspace gate on every OS, and its msrv job checks the
|
# fmt, clippy and the tests run in the Workspace gate on every OS, and its msrv job checks the
|
||||||
# workspace on 1.95; this checks the web build on 1.95.
|
# workspace on 1.95; this checks the web build on 1.95.
|
||||||
|
|||||||
@@ -16,11 +16,10 @@ env:
|
|||||||
PROPTEST_CASES: "64"
|
PROPTEST_CASES: "64"
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it
|
# too, since the newest run checks everything before it.
|
||||||
# always gets to save the cache.
|
group: shared-pdf-${{ github.ref }}
|
||||||
group: shared-pdf-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
cancel-in-progress: true
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
native:
|
native:
|
||||||
|
|||||||
@@ -12,11 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it
|
# too, since the newest run checks everything before it.
|
||||||
# always gets to save the cache.
|
group: craft-proof-${{ github.ref }}
|
||||||
group: craft-proof-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
cancel-in-progress: true
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: update-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: update-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
# fmt, clippy and the tests with default and with all features run in the Workspace gate on every
|
# fmt, clippy and the tests with default and with all features run in the Workspace gate on every
|
||||||
# OS; this runs the egui feature alone.
|
# OS; this runs the egui feature alone.
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: vectorcraft-format-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: vectorcraft-format-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
# fmt, clippy and the tests run in the Workspace gate on every OS, and its msrv job checks the
|
# fmt, clippy and the tests run in the Workspace gate on every OS, and its msrv job checks the
|
||||||
# workspace on 1.95; this checks the web build on 1.95.
|
# workspace on 1.95; this checks the web build on 1.95.
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: web-api-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: web-api-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
web-api:
|
web-api:
|
||||||
|
|||||||
@@ -12,11 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it
|
# too, since the newest run checks everything before it.
|
||||||
# always gets to save the cache.
|
group: shared-web-host-${{ github.ref }}
|
||||||
group: shared-web-host-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
cancel-in-progress: true
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# One group per pull request and per branch: a newer push cancels the run it supersedes, on main
|
||||||
# run (main, manual) gets a group of its own, so it is neither cancelled nor replaced while queued.
|
# too, since the newest run checks everything before it.
|
||||||
group: window-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
group: window-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
# fmt, clippy and the tests with default and with all features (egui and restore together) run in
|
# fmt, clippy and the tests with default and with all features (egui and restore together) run in
|
||||||
# the Workspace gate on every OS; this runs each feature alone.
|
# the Workspace gate on every OS; this runs each feature alone.
|
||||||
|
|||||||
@@ -6,17 +6,21 @@ on:
|
|||||||
tags: ["v*"]
|
tags: ["v*"]
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
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:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
|
# A pull request, and main, each have one group, so a newer push cancels the run it supersedes;
|
||||||
# run (push to main, a release tag, a manual run) gets a group of its own: it is neither
|
# the newest push's run still tests everything before it. Every other run (a release tag, a
|
||||||
# cancelled nor replaced while queued, so a main run always finishes and saves the dependency
|
# manual run, the scheduled run) gets a group of its own and is neither cancelled nor replaced
|
||||||
# cache, and a release run is never cancelled.
|
# while queued: a release run always finishes, and the scheduled run saves the caches.
|
||||||
group: workspace-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
|
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' }}
|
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
native:
|
native:
|
||||||
@@ -24,6 +28,11 @@ jobs:
|
|||||||
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
|
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
|
||||||
with:
|
with:
|
||||||
os: '["ubuntu-latest","windows-latest","macos-latest"]'
|
os: '["ubuntu-latest","windows-latest","macos-latest"]'
|
||||||
|
# On a pull request, macOS and Windows run only when it can change platform behaviour: a
|
||||||
|
# crate with platform cfg code or one that depends on it, the build setup, or a file outside
|
||||||
|
# the crates (craft-common-actions' select-platforms). The full-ci label runs them anyway
|
||||||
|
# from the next push or manual run; pushes to main always run every leg.
|
||||||
|
select-os: '["windows-latest","macos-latest"]'
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
# Every leg runs its tests with nextest, and its doctests with cargo test (.config/nextest.toml).
|
# Every leg runs its tests with nextest, and its doctests with cargo test (.config/nextest.toml).
|
||||||
tools: cargo-nextest@0.9.150
|
tools: cargo-nextest@0.9.150
|
||||||
@@ -44,24 +53,30 @@ jobs:
|
|||||||
CRAFT_HOSTILE_DIVISOR=8
|
CRAFT_HOSTILE_DIVISOR=8
|
||||||
PROPTEST_CASES=64
|
PROPTEST_CASES=64
|
||||||
setup-command: bash scripts/ci-test-inputs.sh
|
setup-command: bash scripts/ci-test-inputs.sh
|
||||||
command: |
|
# The PhotoCraft corpora, keyed on the script that pins them: a hit skips the PhotoCraft
|
||||||
python3 scripts/test-workspace-concurrency.py
|
# checkout and its xtask build (1:51 on Windows).
|
||||||
python3 scripts/test-workspace-tests.py
|
cache-paths: .test-inputs/photocraft/corpus
|
||||||
|
cache-key: photocraft-corpus
|
||||||
|
cache-key-files: scripts/ci-test-inputs.sh
|
||||||
|
# A `lint (<os>)` leg beside each `gate (<os>)` leg, so clippy is off the tests' critical path.
|
||||||
|
lint-command: |
|
||||||
|
if [ "$RUNNER_OS" = Linux ]; then
|
||||||
|
python3 scripts/test-workspace-concurrency.py
|
||||||
|
python3 scripts/test-workspace-tests.py
|
||||||
|
fi
|
||||||
cargo fmt --check
|
cargo fmt --check
|
||||||
cargo clippy --workspace --all-targets --locked -- -D warnings
|
cargo clippy --workspace --all-targets --locked -- -D warnings
|
||||||
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
||||||
|
command: |
|
||||||
# The tests run once, with every feature, in parallel across test binaries; nextest skips
|
# The tests run once, with every feature, in parallel across test binaries; nextest skips
|
||||||
# doctests, so `cargo test --doc` runs them. The default-feature compile is the first
|
# doctests, so `cargo test --doc` runs them. The default-feature compile is the lint leg's
|
||||||
# clippy run's; the second command runs the crates whose tests check behaviour with a
|
# first clippy run; the last command runs the crates whose tests check behaviour with a
|
||||||
# feature off, which an all-features build cannot reach.
|
# feature off, which an all-features build cannot reach.
|
||||||
cargo nextest run --workspace --all-features --locked --profile ci
|
cargo nextest run --workspace --all-features --locked --profile ci
|
||||||
cargo test --workspace --doc --all-features --locked
|
cargo test --workspace --doc --all-features --locked
|
||||||
cargo nextest run -p craft-image-codecs -p craft-text --locked --profile ci
|
cargo nextest run -p craft-image-codecs -p craft-text --locked --profile ci
|
||||||
windows-command: |
|
windows-command: |
|
||||||
powershell.exe -NoProfile -Command '$ErrorActionPreference = "Stop"; Start-Service Spooler; Add-PrinterDriver -Name "Generic / Text Only"'
|
powershell.exe -NoProfile -Command '$ErrorActionPreference = "Stop"; Start-Service Spooler; Add-PrinterDriver -Name "Generic / Text Only"'
|
||||||
cargo fmt --check
|
|
||||||
cargo clippy --workspace --all-targets --locked -- -D warnings
|
|
||||||
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
|
||||||
cargo nextest run --workspace --all-features --locked --profile ci
|
cargo nextest run --workspace --all-features --locked --profile ci
|
||||||
cargo test --workspace --doc --all-features --locked
|
cargo test --workspace --doc --all-features --locked
|
||||||
cargo nextest run -p craft-image-codecs -p craft-text --locked --profile ci
|
cargo nextest run -p craft-image-codecs -p craft-text --locked --profile ci
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Check the Workspace workflow's pull-request-only cancellation policy.
|
"""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
|
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
|
reads those fields, requires the documented expression shapes, and checks which group each event
|
||||||
@@ -21,16 +22,28 @@ except ImportError:
|
|||||||
yaml = None
|
yaml = None
|
||||||
|
|
||||||
DEFAULT_WORKFLOW = Path(__file__).resolve().parent.parent / ".github" / "workflows" / "workspace.yml"
|
DEFAULT_WORKFLOW = Path(__file__).resolve().parent.parent / ".github" / "workflows" / "workspace.yml"
|
||||||
PULL_REQUEST, PUSH, DISPATCH = "pull_request", "push", "workflow_dispatch"
|
PULL_REQUEST, PUSH, DISPATCH, SCHEDULE = "pull_request", "push", "workflow_dispatch", "schedule"
|
||||||
|
|
||||||
# The two shapes this policy may use. GitHub reads `a && b || c` as "b, or c when a is false"; these
|
# The runs that share a group per ref and cancel the run they supersede. GitHub reads `a || b && c`
|
||||||
# patterns are the whole of that expression language this script understands, so a reworded policy
|
# as `a || (b && c)`, and `x && github.ref || github.run_id` as "github.ref, or the run id when x is
|
||||||
# has to be reworded here too, on purpose. github.ref, never github.head_ref or github.sha.
|
# false". This exact condition is the whole of the expression language this script understands, so
|
||||||
|
# a reworded policy has to be reworded here too, on purpose. github.ref, never github.head_ref or
|
||||||
|
# github.sha.
|
||||||
|
SUPERSEDED = "github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/main'"
|
||||||
GROUP_SHAPE = re.compile(
|
GROUP_SHAPE = re.compile(
|
||||||
r"(?P<prefix>[A-Za-z0-9._-]+)-\$\{\{\s*github\.event_name\s*==\s*'(?P<event>[a-z_]+)'\s*"
|
r"(?P<prefix>[A-Za-z0-9._-]+)-\$\{\{\s*\(\s*(?P<condition>[^()]+?)\s*\)\s*"
|
||||||
r"&&\s*github\.ref\s*\|\|\s*github\.run_id\s*\}\}"
|
r"&&\s*github\.ref\s*\|\|\s*github\.run_id\s*\}\}"
|
||||||
)
|
)
|
||||||
CANCEL_SHAPE = re.compile(r"\$\{\{\s*github\.event_name\s*==\s*'(?P<event>[a-z_]+)'\s*\}\}")
|
CANCEL_SHAPE = re.compile(r"\$\{\{\s*(?P<condition>[^{}]+?)\s*\}\}")
|
||||||
|
|
||||||
|
|
||||||
|
def normal(expression):
|
||||||
|
return re.sub(r"\s+", " ", expression).strip()
|
||||||
|
|
||||||
|
|
||||||
|
def superseded(event_name, ref):
|
||||||
|
"""SUPERSEDED, evaluated."""
|
||||||
|
return event_name == PULL_REQUEST or (event_name == PUSH and ref == "refs/heads/main")
|
||||||
|
|
||||||
|
|
||||||
def read_concurrency(text):
|
def read_concurrency(text):
|
||||||
@@ -72,22 +85,25 @@ def other_run(event_name, ref, run_id):
|
|||||||
MAIN, TAG = ("refs/heads/main", "refs/tags/v1.2.3")
|
MAIN, TAG = ("refs/heads/main", "refs/tags/v1.2.3")
|
||||||
SAME_GROUP = [
|
SAME_GROUP = [
|
||||||
("a newer commit on the same pull request", pull_request(1316, 43599251877), pull_request(1316, 43600899878)),
|
("a newer commit on the same pull request", pull_request(1316, 43599251877), pull_request(1316, 43600899878)),
|
||||||
("a rerun of one main run", other_run(PUSH, MAIN, 7001), other_run(PUSH, MAIN, 7001)),
|
("two pushes to main", other_run(PUSH, MAIN, 3), other_run(PUSH, MAIN, 4)),
|
||||||
]
|
]
|
||||||
DIFFERENT_GROUPS = [
|
DIFFERENT_GROUPS = [
|
||||||
("two pull requests", pull_request(1316, 1), pull_request(1317, 1)),
|
("two pull requests", pull_request(1316, 1), pull_request(1317, 1)),
|
||||||
("the same branch name in two forks", pull_request(1316, 2), pull_request(1400, 2)),
|
("the same branch name in two forks", pull_request(1316, 2), pull_request(1400, 2)),
|
||||||
("two pushes to main", other_run(PUSH, MAIN, 3), other_run(PUSH, MAIN, 4)),
|
|
||||||
("two release tag runs", other_run(PUSH, TAG, 5), other_run(PUSH, TAG, 6)),
|
("two release tag runs", other_run(PUSH, TAG, 5), other_run(PUSH, TAG, 6)),
|
||||||
("two manual runs", other_run(DISPATCH, MAIN, 7), other_run(DISPATCH, MAIN, 8)),
|
("two manual runs", other_run(DISPATCH, MAIN, 7), other_run(DISPATCH, MAIN, 8)),
|
||||||
|
("two scheduled runs", other_run(SCHEDULE, MAIN, 15), other_run(SCHEDULE, MAIN, 16)),
|
||||||
|
("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 pull request", other_run(PUSH, MAIN, 9), pull_request(1316, 9)),
|
||||||
("a release tag and a pull request", other_run(PUSH, TAG, 10), pull_request(1316, 10)),
|
("a release tag and a pull request", other_run(PUSH, TAG, 10), pull_request(1316, 10)),
|
||||||
]
|
]
|
||||||
CANCELLATION = [
|
CANCELLATION = [
|
||||||
("a push supersedes the previous run of its pull request", pull_request(1316, 11), True),
|
("a push supersedes the previous run of its pull request", pull_request(1316, 11), True),
|
||||||
("a push to main is never cancelled", other_run(PUSH, MAIN, 12), False),
|
("a push to main supersedes the previous main run", other_run(PUSH, MAIN, 12), True),
|
||||||
("a release tag run is never cancelled", other_run(PUSH, TAG, 13), 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),
|
("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),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -103,17 +119,17 @@ class ConcurrencyTests(unittest.TestCase):
|
|||||||
if not cls.group_shape or not cls.cancel_shape:
|
if not cls.group_shape or not cls.cancel_shape:
|
||||||
raise AssertionError(f"the concurrency fields are not the documented shapes: {cls.fields}")
|
raise AssertionError(f"the concurrency fields are not the documented shapes: {cls.fields}")
|
||||||
|
|
||||||
def cancels(self, event_name):
|
def cancels(self, event_name, ref):
|
||||||
return event_name == self.cancel_shape["event"]
|
return superseded(event_name, ref)
|
||||||
|
|
||||||
def group(self, event_name, ref, run_id):
|
def group(self, event_name, ref, run_id):
|
||||||
return self.group_shape["prefix"] + "-" + (ref if event_name == self.group_shape["event"] else str(run_id))
|
return self.group_shape["prefix"] + "-" + (ref if superseded(event_name, ref) else str(run_id))
|
||||||
|
|
||||||
def test_policy_is_the_two_documented_fields(self):
|
def test_policy_is_the_two_documented_fields(self):
|
||||||
self.assertEqual(sorted(self.fields), ["cancel-in-progress", "group"])
|
self.assertEqual(sorted(self.fields), ["cancel-in-progress", "group"])
|
||||||
self.assertEqual(self.group_shape["prefix"], "workspace")
|
self.assertEqual(self.group_shape["prefix"], "workspace")
|
||||||
self.assertEqual(self.group_shape["event"], PULL_REQUEST)
|
self.assertEqual(normal(self.group_shape["condition"]), SUPERSEDED)
|
||||||
self.assertEqual(self.cancel_shape["event"], PULL_REQUEST)
|
self.assertEqual(normal(self.cancel_shape["condition"]), SUPERSEDED)
|
||||||
|
|
||||||
def test_a_scalar_concurrency_value_is_not_read_as_a_mapping(self):
|
def test_a_scalar_concurrency_value_is_not_read_as_a_mapping(self):
|
||||||
cases = {
|
cases = {
|
||||||
@@ -133,10 +149,10 @@ class ConcurrencyTests(unittest.TestCase):
|
|||||||
with self.subTest(description):
|
with self.subTest(description):
|
||||||
self.assertNotEqual(self.group(*first), self.group(*second), description)
|
self.assertNotEqual(self.group(*first), self.group(*second), description)
|
||||||
|
|
||||||
def test_only_a_pull_request_cancels(self):
|
def test_only_pull_requests_and_main_pushes_cancel(self):
|
||||||
for description, context, expected in CANCELLATION:
|
for description, context, expected in CANCELLATION:
|
||||||
with self.subTest(description):
|
with self.subTest(description):
|
||||||
self.assertEqual(self.cancels(context[0]), expected, description)
|
self.assertEqual(self.cancels(context[0], context[1]), expected, description)
|
||||||
|
|
||||||
def test_pyyaml_reads_the_same_fields(self):
|
def test_pyyaml_reads_the_same_fields(self):
|
||||||
if yaml is None:
|
if yaml is None:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ def block(text, name):
|
|||||||
return "\n".join(line[8:] for line in match[1].splitlines())
|
return "\n".join(line[8:] for line in match[1].splitlines())
|
||||||
|
|
||||||
|
|
||||||
def commands(os_name, fail=""):
|
def commands(os_name, fail="", name="command"):
|
||||||
# Functions avoid executing any caller-supplied cargo command or changing the workspace.
|
# Functions avoid executing any caller-supplied cargo command or changing the workspace.
|
||||||
# The real bash -euo pipefail semantics still apply, including failures inside a branch.
|
# The real bash -euo pipefail semantics still apply, including failures inside a branch.
|
||||||
stub = """
|
stub = """
|
||||||
@@ -29,7 +29,7 @@ cargo() {
|
|||||||
python3() { :; }
|
python3() { :; }
|
||||||
"""
|
"""
|
||||||
return subprocess.run(
|
return subprocess.run(
|
||||||
["bash", "-euo", "pipefail", "-c", stub + block(WORKFLOW.read_text(), "command")],
|
["bash", "-euo", "pipefail", "-c", stub + block(WORKFLOW.read_text(), name)],
|
||||||
env={**os.environ, "RUNNER_OS": os_name, "FAIL": fail},
|
env={**os.environ, "RUNNER_OS": os_name, "FAIL": fail},
|
||||||
text=True, capture_output=True, check=False,
|
text=True, capture_output=True, check=False,
|
||||||
)
|
)
|
||||||
@@ -48,24 +48,32 @@ TESTS = [
|
|||||||
|
|
||||||
|
|
||||||
class WorkspaceTests(unittest.TestCase):
|
class WorkspaceTests(unittest.TestCase):
|
||||||
|
def test_every_leg_lints_with_both_feature_sets(self):
|
||||||
|
for os_name in ("Linux", "macOS", "Windows"):
|
||||||
|
with self.subTest(os=os_name):
|
||||||
|
result = commands(os_name, name="lint-command")
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertEqual(result.stdout.splitlines(), COMMON)
|
||||||
|
|
||||||
def test_linux_and_macos_run_one_feature_set_with_doctests(self):
|
def test_linux_and_macos_run_one_feature_set_with_doctests(self):
|
||||||
for os_name in ("Linux", "macOS"):
|
for os_name in ("Linux", "macOS"):
|
||||||
with self.subTest(os=os_name):
|
with self.subTest(os=os_name):
|
||||||
result = commands(os_name)
|
result = commands(os_name)
|
||||||
self.assertEqual(result.returncode, 0, result.stderr)
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
self.assertEqual(result.stdout.splitlines(), COMMON + TESTS)
|
self.assertEqual(result.stdout.splitlines(), TESTS)
|
||||||
|
|
||||||
def test_each_stage_failure_remains_fatal(self):
|
def test_each_stage_failure_remains_fatal(self):
|
||||||
for index, command in enumerate(COMMON + TESTS):
|
for name, stages in (("lint-command", COMMON), ("command", TESTS)):
|
||||||
with self.subTest(command=command):
|
for index, command in enumerate(stages):
|
||||||
result = commands("Linux", command)
|
with self.subTest(block=name, command=command):
|
||||||
self.assertEqual(result.returncode, 17, result.stderr)
|
result = commands("Linux", command, name)
|
||||||
self.assertEqual(result.stdout.splitlines(), (COMMON + TESTS)[:index + 1])
|
self.assertEqual(result.returncode, 17, result.stderr)
|
||||||
|
self.assertEqual(result.stdout.splitlines(), stages[:index + 1])
|
||||||
|
|
||||||
def test_windows_runs_the_same_cargo_commands(self):
|
def test_windows_runs_the_same_tests(self):
|
||||||
source = block(WORKFLOW.read_text(), "windows-command")
|
source = block(WORKFLOW.read_text(), "windows-command")
|
||||||
cargo = [line.strip() for line in source.splitlines() if line.strip().startswith("cargo ")]
|
cargo = [line.strip() for line in source.splitlines() if line.strip().startswith("cargo ")]
|
||||||
self.assertEqual(cargo, ["cargo " + command for command in COMMON + TESTS])
|
self.assertEqual(cargo, ["cargo " + command for command in TESTS])
|
||||||
|
|
||||||
def test_ci_profile_keeps_its_failure_policy_without_retries_or_filtering(self):
|
def test_ci_profile_keeps_its_failure_policy_without_retries_or_filtering(self):
|
||||||
config = tomllib.loads((ROOT / ".config/nextest.toml").read_text())
|
config = tomllib.loads((ROOT / ".config/nextest.toml").read_text())
|
||||||
@@ -94,7 +102,7 @@ class WorkspaceTests(unittest.TestCase):
|
|||||||
self.assertIn('os: \'["ubuntu-latest","windows-latest","macos-latest"]\'', source)
|
self.assertIn('os: \'["ubuntu-latest","windows-latest","macos-latest"]\'', source)
|
||||||
self.assertIn(" msrv:", source)
|
self.assertIn(" msrv:", source)
|
||||||
self.assertIn(" wasm:", source)
|
self.assertIn(" wasm:", source)
|
||||||
self.assertIn("python3 scripts/test-workspace-tests.py", block(source, "command"))
|
self.assertIn("python3 scripts/test-workspace-tests.py", block(source, "lint-command"))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user