Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
ci(verify): case-level shards, per-platform FAST trims, optional archive mode
Richie McIlroy817b52f2452c
diff --git a/.github/workflows/engine-verify-os.yml b/.github/workflows/engine-verify-os.ymlindex 121a11b19..cf451e5ab 100644--- a/.github/workflows/engine-verify-os.yml+++ b/.github/workflows/engine-verify-os.yml@@ -1,9 +1,13 @@name: Engine verify (one platform)-# Called by engine-verify.yml once per platform. With one shard the build job-# also runs the tests (no artifact round trip, one runner: macOS runners are-# the scarce resource). With more shards it uploads a nextest archive and the-# shard jobs run partitions of it.+# Called by engine-verify.yml once per platform. Cases are split across+# `shards` jobs by a stable hash of the case id (CAP_VERIFY_SHARD), so a suite+# whose test functions loop over many cases still spreads evenly.+#+# By default every shard builds for itself: with the Rust cache and+# scripts/verify/mtime.py a warm build only compiles what changed, which is+# cheaper than an artifact round trip and a second runner queue. With+# `archive: true` one job builds a nextest archive and the shards run it.on:workflow_call:@@ -29,6 +33,9 @@ on:shard-list:type: stringdefault: "[1]"+ archive:+ type: boolean+ default: falsesave-cache:type: booleandefault: false@@ -50,7 +57,8 @@ env:jobs:build:- name: ${{ inputs.shards > 1 && 'build' || 'build and test' }}+ name: build+ if: inputs.archiveruns-on: ${{ inputs.runner }}timeout-minutes: 60steps:@@ -59,28 +67,15 @@ jobs:persist-credentials: false- name: Setup- id: setupuses: ./.github/actions/engine-verify-setupwith:target: ${{ inputs.target }}tier: ${{ inputs.tier }}save-cache: ${{ inputs.save-cache }}- - name: Report location+ - name: Build archiveshell: bash- run: |- echo "CAP_VERIFY_REPORT_DIR=$RUNNER_TEMP/verify-report" >> "$GITHUB_ENV"- echo "CAP_VERIFY_FLAKY_FILE=$RUNNER_TEMP/verify-report/flaky.txt" >> "$GITHUB_ENV"-- - name: Build- shell: bash- run: |- shards="${{ inputs.shards }}"- if (( shards > 1 )); then- scripts/verify/run.sh "${{ inputs.tier }}" --suites "${{ inputs.suites }}" --archive "$RUNNER_TEMP/verify.tar.zst"- else- scripts/verify/run.sh "${{ inputs.tier }}" --suites "${{ inputs.suites }}" --no-run- fi+ run: scripts/verify/run.sh "${{ inputs.tier }}" --suites "${{ inputs.suites }}" --archive "$RUNNER_TEMP/verify.tar.zst"- name: Record sources of the cached buildif: inputs.save-cache@@ -88,58 +83,25 @@ jobs:run: |"$(command -v python3 || command -v python)" scripts/verify/mtime.py record target/ci-verify/.fingerprint/cap-verify-srcmanifest- - name: Upload test archive- if: inputs.shards > 1- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2with:name: verify-archive-${{ inputs.platform }}-${{ github.run_attempt }}path: ${{ runner.temp }}/verify.tar.zstretention-days: 1compression-level: 0- - name: Test- id: test- if: inputs.shards == 1- shell: bash- run: scripts/verify/run.sh "${{ inputs.tier }}" --suites "${{ inputs.suites }}"-- - name: Summary- if: always() && inputs.shards == 1 && steps.test.outcome != 'skipped'- shell: bash- run: >-- "$(command -v python3 || command -v python)" scripts/verify/summary.py --title "${{ inputs.platform }} ${{ inputs.tier }}"- --junit "$CAP_VERIFY_REPORT_DIR/junit.xml" --flaky "$CAP_VERIFY_FLAKY_FILE"- "$CAP_VERIFY_REPORT_DIR" >> "$GITHUB_STEP_SUMMARY"-- - name: Upload report- if: always() && inputs.shards == 1 && steps.test.outcome != 'skipped'- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2- with:- name: verify-report-${{ inputs.platform }}-${{ inputs.tier }}-1- path: ${{ runner.temp }}/verify-report- if-no-files-found: ignore- retention-days: 14-- - name: Save fixtures- if: always() && inputs.save-cache && steps.setup.outputs.fixtures-hit != 'true' && inputs.shards == 1- uses: actions/cache/save@v4- with:- path: ${{ runner.temp }}/verify-fixtures- key: ${{ steps.setup.outputs.fixtures-key }}-test:- name: shard ${{ matrix.shard }}/${{ inputs.shards }}+ name: ${{ inputs.shards > 1 && format('test {0}/{1}', matrix.shard, inputs.shards) || 'build and test' }}needs: build- if: inputs.shards > 1+ if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped')runs-on: ${{ inputs.runner }}- timeout-minutes: 45+ timeout-minutes: 60strategy:fail-fast: falsematrix:shard: ${{ fromJSON(inputs.shard-list) }}env:- # Shards run prebuilt binaries: no toolchain install for rust-toolchain.toml.- RUSTUP_TOOLCHAIN: stable+ CAP_VERIFY_SHARD: ${{ inputs.shards > 1 && format('{0}/{1}', matrix.shard, inputs.shards) || '' }}steps:- uses: actions/checkout@v4with:@@ -151,7 +113,8 @@ jobs:with:target: ${{ inputs.target }}tier: ${{ inputs.tier }}- rust-cache: "false"+ rust-cache: ${{ !inputs.archive }}+ save-cache: ${{ inputs.save-cache && matrix.shard == 1 }}- name: Report locationshell: bash@@ -159,7 +122,20 @@ jobs:echo "CAP_VERIFY_REPORT_DIR=$RUNNER_TEMP/verify-report" >> "$GITHUB_ENV"echo "CAP_VERIFY_FLAKY_FILE=$RUNNER_TEMP/verify-report/flaky.txt" >> "$GITHUB_ENV"- - uses: actions/download-artifact@v4+ - name: Build+ if: ${{ !inputs.archive }}+ shell: bash+ run: scripts/verify/run.sh "${{ inputs.tier }}" --suites "${{ inputs.suites }}" --no-run++ - name: Record sources of the cached build+ if: ${{ !inputs.archive && inputs.save-cache && matrix.shard == 1 }}+ shell: bash+ run: |+ "$(command -v python3 || command -v python)" scripts/verify/mtime.py record target/ci-verify/.fingerprint/cap-verify-srcmanifest++ - name: Download archive+ if: inputs.archive+ uses: actions/download-artifact@v4with:name: verify-archive-${{ inputs.platform }}-${{ github.run_attempt }}path: ${{ runner.temp }}@@ -167,15 +143,19 @@ jobs:- name: Testid: testshell: bash- run: >-- scripts/verify/run.sh "${{ inputs.tier }}" --suites "${{ inputs.suites }}"- --from-archive "$RUNNER_TEMP/verify.tar.zst" --partition "hash:${{ matrix.shard }}/${{ inputs.shards }}"+ run: |+ if [[ "${{ inputs.archive }}" == true ]]; then+ scripts/verify/run.sh "${{ inputs.tier }}" --suites "${{ inputs.suites }}" --from-archive "$RUNNER_TEMP/verify.tar.zst"+ else+ scripts/verify/run.sh "${{ inputs.tier }}" --suites "${{ inputs.suites }}"+ fi- name: Summaryif: always() && steps.test.outcome != 'skipped'shell: bashrun: >-- "$(command -v python3 || command -v python)" scripts/verify/summary.py --title "${{ inputs.platform }} ${{ inputs.tier }} shard ${{ matrix.shard }}"+ "$(command -v python3 || command -v python)" scripts/verify/summary.py+ --title "${{ inputs.platform }} ${{ inputs.tier }}${{ inputs.shards > 1 && format(' shard {0}/{1}', matrix.shard, inputs.shards) || '' }}"--junit "$CAP_VERIFY_REPORT_DIR/junit.xml" --flaky "$CAP_VERIFY_FLAKY_FILE""$CAP_VERIFY_REPORT_DIR" >> "$GITHUB_STEP_SUMMARY"diff --git a/.github/workflows/engine-verify.yml b/.github/workflows/engine-verify.ymlindex 000a4d6d6..0992c16c3 100644--- a/.github/workflows/engine-verify.yml+++ b/.github/workflows/engine-verify.yml@@ -158,6 +158,7 @@ jobs:suites: ${{ matrix.suites }}shards: ${{ matrix.shards }}shard-list: ${{ matrix.shard_list }}+ archive: ${{ matrix.archive }}save-cache: ${{ needs.plan.outputs.save-cache == 'true' }}cargo-config: ${{ inputs.cargo-config || '' }}diff --git a/crates/rendering/src/decoder/model/mod.rs b/crates/rendering/src/decoder/model/mod.rsindex c55cfc5a7..a6c6bc01c 100644--- a/crates/rendering/src/decoder/model/mod.rs+++ b/crates/rendering/src/decoder/model/mod.rs@@ -814,6 +814,7 @@ fn run_suite(decoder: Decoder) {.as_ref().is_none_or(|filter| case_name(decoder, family).contains(filter.as_str()))})+ .filter(|family| cap_verify_expect::case_selected(&case_name(decoder, family))).collect();let jobs: Vec<(usize, u64)> = families.iter()diff --git a/crates/verify-expect/src/lib.rs b/crates/verify-expect/src/lib.rsindex f9270dd72..762678636 100644--- a/crates/verify-expect/src/lib.rs+++ b/crates/verify-expect/src/lib.rs@@ -109,6 +109,53 @@ pub fn glob_match(pattern: &str, text: &str) -> bool {rest.ends_with(parts[last])}+/// Case selection shared by every suite:+/// - `CAP_VERIFY_CASE`: comma-separated globs; only matching cases run.+/// - `CAP_VERIFY_SKIP`: comma-separated globs; matching cases are skipped+/// (the per-platform FAST tier trims in `scripts/verify/suites.json`).+/// - `CAP_VERIFY_SHARD=i/n`: only cases whose id hashes to shard `i` (1-based)+/// of `n` run, so one suite can be split across CI jobs case by case.+pub fn case_selected(id: &str) -> bool {+ let env = |name: &str| std::env::var(name).ok().filter(|v| !v.trim().is_empty());+ let globs = |value: String| -> Vec<String> {+ value+ .split(',')+ .map(|p| p.trim().to_string())+ .filter(|p| !p.is_empty())+ .collect()+ };+ if let Some(only) = env("CAP_VERIFY_CASE")+ && !globs(only).iter().any(|p| glob_match(p, id))+ {+ return false;+ }+ if let Some(skip) = env("CAP_VERIFY_SKIP")+ && globs(skip).iter().any(|p| glob_match(p, id))+ {+ return false;+ }+ match env("CAP_VERIFY_SHARD").and_then(|v| parse_shard(&v)) {+ Some((index, count)) => shard_of(id, count) == index,+ None => true,+ }+}++fn parse_shard(value: &str) -> Option<(u64, u64)> {+ let (index, count) = value.trim().split_once('/')?;+ let (index, count) = (index.parse().ok()?, count.parse().ok()?);+ (count >= 1 && (1..=count).contains(&index)).then_some((index, count))+}++/// 1-based shard of a case id (FNV-1a, stable across platforms and runs).+pub fn shard_of(id: &str, count: u64) -> u64 {+ let mut hash: u64 = 0xcbf2_9ce4_8422_2325;+ for byte in id.bytes() {+ hash ^= u64::from(byte);+ hash = hash.wrapping_mul(0x0100_0000_01b3);+ }+ hash % count.max(1) + 1+}+pub fn parse_seeds(text: &str) -> Result<BTreeSet<u64>, String> {let mut seeds = BTreeSet::new();for item in text.split_whitespace() {@@ -658,6 +705,21 @@ mod tests {assert!(!glob_match("a", "ab"));}+ #[test]+ fn shards_partition_cases() {+ let ids: Vec<String> = (0..200).map(|i| format!("export/case-{i}/avf")).collect();+ let mut counts = [0usize; 3];+ for id in &ids {+ let shard = shard_of(id, 3);+ assert!((1..=3).contains(&shard));+ counts[(shard - 1) as usize] += 1;+ }+ assert!(counts.iter().all(|&n| n > 40), "{counts:?}");+ assert_eq!(parse_shard("2/3"), Some((2, 3)));+ assert_eq!(parse_shard("4/3"), None);+ assert_eq!(parse_shard("0/3"), None);+ }+#[test]fn seed_lists_round_trip() {let seeds = parse_seeds("0 2 3 5-9 12").unwrap();diff --git a/crates/verify/src/report.rs b/crates/verify/src/report.rsindex 29d886031..de8ee4e50 100644--- a/crates/verify/src/report.rs+++ b/crates/verify/src/report.rs@@ -159,12 +159,10 @@ fn repro_command(id: &str) -> String {)}-/// Whether a case id is selected by `CAP_VERIFY_CASE` (glob, default all).+/// Whether a case runs: `CAP_VERIFY_CASE`, `CAP_VERIFY_SKIP` and+/// `CAP_VERIFY_SHARD` (see `cap_verify_expect::case_selected`).pub fn selected(id: &str) -> bool {- match std::env::var("CAP_VERIFY_CASE") {- Ok(pattern) if !pattern.is_empty() => pattern.split(',').any(|p| glob_match(p, id)),- _ => true,- }+ cap_verify_expect::case_selected(id)}fn write_result(result: &CaseResult, classes: &BTreeMap<String, String>) {diff --git a/scripts/verify/plan.py b/scripts/verify/plan.pyindex 940bd75d3..e092bd683 100755--- a/scripts/verify/plan.py+++ b/scripts/verify/plan.py@@ -1,9 +1,9 @@#!/usr/bin/env python3"""Plans engine verification runs from scripts/verify/suites.json.- plan.py select --tier fast --platform linux [--suites a,b]- Prints three lines for run.sh: the suite names, the cargo target- selection and the nextest filter expression.+ plan.py select --tier fast --platform linux [--suites a,b] [--local]+ Prints four lines for run.sh: the suite names, the cargo target+ selection, the nextest filter expression and the case globs to skip.plan.py changes --tier fast [--files FILE | --all] [--metadata FILE]Maps changed paths to suites through the workspace dependency graph@@ -95,6 +95,12 @@ def cmd_select(args):print(" ".join(s["name"] for s in suites))print(" ".join(cargo_args(suites)))print(" or ".join(f"({suite_filter(s)})" for s in suites))+ skips = []+ for suite in suites:+ for glob in suite.get("skip", {}).get(args.tier, {}).get(args.platform, []):+ if glob not in skips:+ skips.append(glob)+ print(",".join(skips))def workspace_graph(metadata):@@ -181,6 +187,7 @@ def matrix(config, names, tier):"target": runner["target"],"shards": runner["shards"],"shard_list": json.dumps(list(range(1, runner["shards"] + 1))),+ "archive": runner.get("archive", False),"suites": ",".join(suites),})return {"include": include}diff --git a/scripts/verify/run.sh b/scripts/verify/run.shindex 0f8ac605b..4e0249346 100755--- a/scripts/verify/run.sh+++ b/scripts/verify/run.sh@@ -62,6 +62,10 @@ plan="$("$py" scripts/verify/plan.py select --tier "$tier" --platform "$platformsuite_names="$(sed -n 1p <<<"$plan")"read -r -a cargo_args <<<"$(sed -n 2p <<<"$plan")"filter="$(sed -n 3p <<<"$plan")"+skip="$(sed -n 4p <<<"$plan")"+if [[ -n "$skip" ]]; then+ export CAP_VERIFY_SKIP="${CAP_VERIFY_SKIP:+$CAP_VERIFY_SKIP,}$skip"+fiif [[ -z "$suite_names" ]]; thenecho "no $tier suites for $platform${suites:+ in $suites}"@@ -85,10 +89,11 @@ nextest_profile="${CAP_VERIFY_NEXTEST_PROFILE:-default}"export CAP_VERIFY_TIER="$tier"export CAP_VERIFY_REPORT_DIR="${CAP_VERIFY_REPORT_DIR:-$root/target/verify-report/$platform-$tier}"-echo "engine verify: $tier tier on $platform: $suite_names"+echo "engine verify: $tier tier on $platform: $suite_names${CAP_VERIFY_SHARD:+ (case shard $CAP_VERIFY_SHARD)}"if [[ "$mode" == list ]]; thenecho "cargo: ${cargo_args[*]}"echo "filter: $filter"+ echo "skip: ${CAP_VERIFY_SKIP:-}"exit 0fidiff --git a/scripts/verify/suites.json b/scripts/verify/suites.jsonindex af85eb24c..157823c98 100644--- a/scripts/verify/suites.json+++ b/scripts/verify/suites.json@@ -1,5 +1,5 @@{- "_doc": "Engine verification suites. Read by scripts/verify/plan.py (CI planning, change detection) and scripts/verify/run.sh (local and CI runs). Fields: cargo = the cargo target selection that builds the suite; test = optional exact test name inside that binary; platforms = where each tier runs it (platform-independent logic runs on linux only); roots = workspace packages whose dependency closure decides whether a change can affect the suite; own = files that only affect this suite (a change confined to them selects just this suite).",+ "_doc": "Engine verification suites. Read by scripts/verify/plan.py (CI planning, change detection) and scripts/verify/run.sh (local and CI runs). Fields: cargo = the cargo target selection that builds the suite; test = optional exact test name inside that binary; platforms = where each tier runs it (platform-independent logic runs on linux only); roots = workspace packages whose dependency closure decides whether a change can affect the suite; own = files that only affect this suite (a change confined to them selects just this suite). skip = case-id globs left out of a tier on a platform (CAP_VERIFY_SKIP), to keep the FAST tier within its time budget; the FULL tier runs them.","suites": [{"name": "verify-self",@@ -60,7 +60,20 @@],"own": ["crates/verify/tests/export.rs"- ]+ ],+ "skip": {+ "fast": {+ "macos": [+ "export/*/ffmpeg",+ "export/backward-hold/*/mp430/*"+ ],+ "windows": [+ "export/*/mp460/*",+ "export/backward-hold/*",+ "export/jitter-camera-*"+ ]+ }+ }},{"name": "playback",@@ -90,7 +103,14 @@],"own": ["crates/verify/tests/playback.rs"- ]+ ],+ "skip": {+ "fast": {+ "macos": [+ "playback/*/ffmpeg"+ ]+ }+ }},{"name": "seek",@@ -120,7 +140,14 @@],"own": ["crates/verify/tests/seek.rs"- ]+ ],+ "skip": {+ "fast": {+ "macos": [+ "seek/*/ffmpeg"+ ]+ }+ }},{"name": "audio",@@ -154,7 +181,16 @@"crates/verify/tests/audio_support/**","crates/verify/src/audio_model.rs","crates/verify/src/audio_fixture.rs"- ]+ ],+ "skip": {+ "fast": {+ "windows": [+ "audio/*/mp4-plain30",+ "audio/*/gif30",+ "audio/*/mov30"+ ]+ }+ }},{"name": "decoder-model-ffmpeg",@@ -223,17 +259,20 @@"linux": {"runner": "ubuntu-24.04","target": "x86_64-unknown-linux-gnu",- "shards": 1+ "shards": 1,+ "archive": false},"macos": {"runner": "macos-15","target": "aarch64-apple-darwin",- "shards": 1+ "shards": 2,+ "archive": false},"windows": {"runner": "windows-2022","target": "x86_64-pc-windows-msvc",- "shards": 1+ "shards": 2,+ "archive": false}}}