Skip to content

ci: en setup-action, en lista över cargo-grindar, strukturella CI-tester (#358) - #435

Merged
Magnus-Gille merged 8 commits into
mainfrom
claude/358-ci-dedupe
Oct 16, 2026
Merged

Magnus-Gille merged 8 commits into
mainfrom
claude/358-ci-dedupe

Conversation

@Magnus-Gille

@Magnus-Gille Magnus-Gille commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

What

ci.yml går från 976 till 348 rader. Varje grind finns på ett ställe och körs likadant på alla tre operativsystemen. CI-testerna läser YAML-strukturen i stället för att matcha text med regex.

Struktur

  • .github/actions/setup är en composite action för förberedelsen: Python, Rust-toolchain (eller MSRV), Node, rust-cache, apt-bibliotek, modellcache och npm ci. Checkout ligger kvar i varje jobb.
  • scripts/ci/cargo-gates.mjs är den enda listan över cargo-grindar.
    • Varje OS-spår kör den med --os, och msrv-linux med --profile msrv.
    • Undantag per OS är os:-poster med ett why, och ett test kräver motiveringen.
  • scripts/ci/smoke-cli.mjs är ett plattformsoberoende smoke-skript med nivåerna basic och model. Det ersätter fyra inline-block i bash och PowerShell.
  • scripts/ci/assert-lanes.mjs utgör kroppen i check-*-jobben.
    • Jobben körs med if: always() och får NEEDS: toJSON(needs).
    • Allt som inte är success fäller jobbet: misslyckat, avbrutet, överhoppat på en full körning, okänt docs_only eller felaktig indata.
  • scope ligger kvar inline, eftersom det jobbet checkar ut PR:ens bas, som saknar de nya skripten.
  • ci.yml innehåller nu bara kopplingen mellan jobben. dependabot.yml täcker också action-katalogen.
  • De obligatoriska kontrollerna check-macos och check-windows heter samma sak och aggregerar samma spår.

Samma grindar på alla OS. Jämförelsen kommer från jobbloggarna: main 65b5247 mot PR:ens körning.

Före Nu
Alla tre OS – clippy --workspace --all-targets, test --workspace, clippy -p core, test -p core, clippy -p cli --no-default-features, test -p cli --no-default-features
Windows saknade lean-CLI:ts clippy och test samt ORT-hostens clippy samma sex, plus ORT-hostens clippy och test
Linux körde inte workspace-test och -clippy samma sex, plus fmt, deny, core diarization och record, ORT, lean-bygget, ALSA-trädet och release-vakten
MSRV tre cargo check --locked oförändrat

Borttaget för att det täcks av något annat:

  • cargo check, eftersom clippy --all-targets täcker samma mål;
  • en lös cargo test, -p cli och -p engine-protocol, eftersom workspace-grindarna täcker dem;
  • två node-kommandon som npm run test:frontend redan kör.

diarization-testerna körs fortfarande på macOS och Windows inom cargo test --workspace (159 tester). Funktionen har ingen OS-specifik kod.

Windows-testerna ägs av test-windows.

  • test-windows är den obligatoriska kontrollen och enda ägaren på PR:er.
  • På pull_request hoppar windows-package.yml nu över cargo test --workspace och cargo clippy --workspace för båda arkitekturerna. Release (workflow_call) och manuell körning är oförändrade.
  • Skälet: steget var ett PowerShell-steg med flera kommandon, där bara det sistas exitkod räknades. Ett test- eller clippy-fel fällde alltså aldrig jobbet.
  • Följden: ARM64 kör inte längre cargo test och clippy på PR:er. Det var bara logg, aldrig en grind. ARM64 bygger fortfarande lean-CLI:t, appens testbinär och release-CLI:t på varje PR, och det finns ingen Windows-kod som är specifik för aarch64.

Strukturella CI-tester

  • scripts/lib/ci-workflow.mjs läser workflow-filerna med yaml, som nu är en deklarerad devDependency. Den låg redan i lockfilen som vites valfria peer, och licensen är ISC.
  • Inga assert.match(ciYaml, …) finns kvar. Tio testfiler är omskrivna, och två är nya: test-ci-cargo-gates och test-ci-smoke-cli, med en körning mot en fejkad binär.
  • Testerna kräver bland annat:
    • att grindskriptet anropas på varje OS;
    • att varje check-* har needs: på varje spår och fäller allt som inte lyckats;
    • att varje Windows-steg med flera kommandon kör shell: bash;
    • att rust-cachens nyckel för grindspåren innehåller listans hash.
  • test-verify-ci-parity.mjs expanderar nu grindlistan och setup-actionen till kommandon, så paritet mellan verify.mjs och CI bevisas fortfarande.

Why

#358: ci.yml upprepade förberedelsen i fem jobb, åtta cargo-steg mellan macOS och Windows, och fyra smoke-block. Kopiorna hade redan glidit isär: Windows saknade diariseringsmatrisen och JSON-strömkontrollen. Regex-testerna låste kopiorna i stället för att skydda strukturen. windows-package.yml körde dessutom cargo test --workspace en gång till på varje PR, utan att den körningen kunde fälla något.

Testing

  • Lokalt på Linux (m5): npm run verify -- --keep-going gav 29 pass och 2 skip (Swift och engine-host-conformance körs bara på macOS). npm run licenses:check: aktuell. CI-gruppen: 245 tester.
  • Oberoende review gjorde 25 mutationer av CI-konfigurationen, och testerna fångade alla. Exempel:
    • ett spår borttaget ur needs;
    • grindanropet borttaget eller flyttat;
    • fel --os;
    • continue-on-error eller if: på en grind;
    • if: always() borttaget;
    • check-windows omdöpt;
    • workspace-grinden gjord Linux-only;
    • windows-package-villkoret borttaget eller inverterat.
  • CI: grönt på alla plattformar vid c08f53b.
    • Vid 53bee3c föll Windows-paketets licenskontroll, eftersom den nya devDependency:n yaml saknades i THIRD_PARTY_NOTICES.md.
    • Det är åtgärdat i bd832e0. Kontrollen ingår inte i verify lokalt.
    • Merge-kön kräver grön CI på slutlig head.

Runner-minuter. Måttet är summan av jobbens väggklocktid. Faktureringsdata finns inte, eftersom repot är publikt.

  • Före: 17 fulla PR-körningar 14–15 oktober. CI plus Windows-paket tog i medel 130 min per PR (median 129, spann 101–156).
  • Efter: ett varmt prov vid c08f53b tog 105,7 min (CI 45,8 + paket 59,9).
    • Paketdelen var kall, eftersom ändrat windows-package.yml gav ny cachenyckel. ARM64 gick från 21,9 till 28,7 min av det skälet, medan x64 gick från 39,9 till 31,1.

    • Per jobb, från gammal head f2cbc92 till ny c08f53b:

      Jobb Före (min) Nu (min)
      test-macos 19,9 9,9
      test-windows 17,4 8,2
      test-linux 6,8 7,4
      msrv 4,6 5,5
      build-macos 10,8 7,2
      build-windows 14,0 7,3
  • Förbehåll:
    • Cachetillståndet dominerar. PR:ens kalla körningar tog 69–84 min för enbart CI.
    • En ändrad grindlista eller ändrat windows-package.yml ger ny cachenyckel, så första körningen på main efter mergen blir kall, ungefär 30 min extra en gång.
    • Den strukturella besparing jag kan visa per steg är ungefär 7 Windows-runner-minuter per PR, från överhoppad cargo test och clippy i paketbygget.
    • Jag mäter igen efter tre varma körningar på main och rapporterar i Avduplicera ci.yml och ersätt regex-testerna på YAML #358.

Review

Oberoende review av Claude Fable 5.1. Författare: Claude Sonnet 5.5.

  • Inga blockerande fynd. Reviewn bekräftade:
    • täckningstabellen per crate, feature, kommando och OS, där inget har tappats;
    • att aggregatorerna fäller allt som inte lyckats;
    • att release-flödena är oförändrade, med samma action-SHA:er, contents: read och inga nya hemligheter;
    • att setup-actionens indata stämmer per jobb.
  • Åtgärdat:
    • yaml är nu deklarerad som devDependency;
    • grindlistans hash ligger bara i grindspårens cachenyckel, så byggjobbens cache överlever en ändrad lista;
    • testet följer relativa importer före npm ci;
    • en mening om förtroendenivå står i ci.yml.
  • Redovisat: måttet på runner-minuter och dess förbehåll, ovan.

Avvikelser och uppföljning

  • windows-package.yml har kvar tre PowerShell-steg med flera kommandon som kan dölja fel:

    • cargo test och clippy på releasevägen;
    • release:check + licenses:check;
    • npm run build + npm run check.

    Att rätta dem ändrar hur releasebyggen grindas och görs därför separat, efter ägarens beslut. release:check grindas redan under bash i release-quality-gate.yml och release-build-macos.yml.

  • check-linux är inte en obligatorisk kontroll i rulesetet. Den är oförändrad här.

  • actionlint fanns inte på värden. Workflow-filerna validerades genom att parsas och genom PR:ens riktiga körningar.

Closes #358

🤖 Generated with Claude Code

Magnus-Gille and others added 7 commits October 14, 2026 22:28
…358)

- .github/actions/setup: the toolchain preamble (Python, Rust, MSRV toolchain,
  Node, rust-cache, model cache, npm ci) that six lanes repeated.
- scripts/ci/cargo-gates.mjs: the one list of cargo gates, run by every lane
  with --os (and --profile msrv); per-OS exclusions carry their reason in the
  list. Workspace clippy and test replace the bare app/CLI invocations, and the
  cargo check steps clippy --all-targets already covers are gone.
- scripts/ci/smoke-cli.mjs: one cross-platform smoke script replaces the four
  inline bash and PowerShell blocks; Windows now verifies the JSON, JSONL and
  error streams like macOS.
- scripts/ci/assert-lanes.mjs: the check-* aggregators run one tested script.
- windows-package.yml: x64 no longer repeats the workspace tests and clippy on
  pull requests (test-windows owns them); ARM64, releases and manual runs keep
  them.
- The ci tests read the workflows as parsed YAML (scripts/lib/ci-workflow.mjs)
  instead of matching text; the parity test expands the gate list and the
  setup action.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
pwsh reports only the last native command's exit code, so a failing
npm run test:frontend ahead of a passing npm run format:check went green in
test-windows. The step now runs under bash, a structural test requires it for
every multi-command step of a Windows lane, and the smoke test compares
recorded commands in one path spelling. windows-package.yml keeps the old
step for every path but the x64 pull request, so release behaviour is
unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
rust-cache saves only when its key is new, and the key follows Cargo.lock, so
the artifacts of a changed gate list would never reach the cache and every run
would recompile them. Appending the hash of scripts/ci/cargo-gates.mjs to the
shared key makes a gate change a new key that the first run saves.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
windows-package.yml no longer repeats cargo test --workspace and cargo clippy
--workspace on a pull request, for either architecture. In that pwsh step only
the last command's exit code counts, so a failing test or lint there never
failed the job; test-windows runs the same workspace gates through
scripts/ci/cargo-gates.mjs and does. Releases (workflow_call from
prebuild-release.yml) and manual runs keep the step unchanged. A pull request
builds the lean debug CLI in a step of its own, which the CPU policy checks
read.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The CI structure tests parse the workflows with yaml, which was only vite's
optional peer. yaml 2.9.1 is the version the lockfile already resolved, so
the lockfile change is the root devDependencies entry and the dropped
optional/peer flags of the existing node_modules/yaml entry; nothing new is
downloaded.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…before npm ci (#358)

- setup action: the native-build input replaces models. The native build
  lanes cache their models and keep the gate list out of their Rust cache key,
  so a gate change no longer evicts the caches of lanes that never run gates;
  the other lanes still carry the hash. A structural test checks both
  directions against the lanes that invoke the gate script.
- scripts/lib/import-graph.mjs: the relative-import walker, shared by the
  test-group package check and by the check that the pre-npm-ci Windows
  identity tests reach no npm package even through a repository module.
- ci.yml header: the check-* jobs run assert-lanes.mjs from the PR checkout,
  at the trust level of ci.yml itself.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Declaring yaml as a devDependency made it a non-optional lockfile
package, so the notice generator now includes its ISC license.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Magnus-Gille
Magnus-Gille marked this pull request as ready for review October 16, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avduplicera ci.yml och ersätt regex-testerna på YAML

1 participant