Skip to content

Latest commit

 

History

History
131 lines (111 loc) · 8.31 KB

continuous-integration.md

File metadata and controls

131 lines (111 loc) · 8.31 KB

Continuous integration

PRs use staged validation so development pushes do not repeat the complete suite. Drafts skip CI jobs. Ready code PRs run repository checks, formatting and a quick native workspace compile. Adding approved-for-ci enables the linux-tests job with Clippy and tests for the affected packages and their dependents. The aggregate checks result reports whether the selected stage passed.

What runs when

Stage/event Work
Draft PR No CI jobs
Documentation-only PR Markdown, schemas and Python/Node repository checks
Code PR without approved-for-ci Repository checks, formatting and quick native compile
Code PR with approved-for-ci Repository checks, formatting, affected-package Clippy and unit/integration tests, plus command-contract comparison
PR changing Cargo manifests, Cargo.lock or deny.toml Dependency license/source/ban checks in addition to its selected stage
Main code push, merge group or manual CI run Full native workspace suite, doctests and opt-in harness; Windows and macOS tests, browser packaging, WASI and dependency checks
Manual CI run on release Full CI on Blacksmith, with the native Windows presentation smoke test on a GitHub-hosted desktop
Manual Release PCBcraft run Blacksmith native workspace tests and packages in parallel; all must pass before a draft or publication and version tag
Unrelated label change on an approved PR Repository checks and reuse of an actual approved native pass for the identical head and merge commit; no new native build

Automatic PR triage labels run when GitHub requests PR CI. The triage workflow uses GitHub's API to match the open PR to the source branch and exact revision. It reads PR metadata without checking out contributor code or using CI artifacts. New and reopened issues trigger triage directly.

Windows and macOS tests, browser packaging, WASI, doctests and the opt-in performance harness do not run on ordinary PR events, even after approval. Removing approved-for-ci returns later pushes to quick feedback. Adding it enables affected native tests; it does not start the broad platform suite. Use Actions → CI → Run workflow on a branch when a full run is needed before merge.

A green PR result means its selected checks passed, not that every platform was qualified. PCBcraft currently has no merge queue or branch protection. Full coverage therefore runs after code lands on main, unless requested manually beforehand. If a merge queue is enabled later, the existing merge-group trigger runs the full suite before its group lands. This policy reduces PR work; it does not establish a faster full cold build or enforce a GitHub merge rule.

Package selection and failure handling

Selection reads NUL-delimited Git paths with renames disabled, checking both sides of a rename. Approved native checks use Cargo metadata to find each source file's workspace package and transitively include packages that depend on it. Normal, build, dev, optional and target-specific dependencies are included conservatively; renamed dependencies retain their original package identity. An app-only source change selects pcbcraft-app, pcbcraft and pcbcraft-web.

Root/configuration changes, manifests, fixtures, scripts, removed owners or missing Git history select the entire native workspace. They cannot select an empty suite. PR tests use Cargo's --tests target selection for unit and integration tests; full events retain default target selection, including doctests, and also run the opt-in performance harness. No Rust test is deleted or newly ignored.

The aggregate rejects failed, cancelled, missing or unexpectedly skipped jobs and malformed stage outputs. Unrelated labels cannot turn a quick pass into approved native coverage. A read-only waiter accepts only an existing successful run with all approved native jobs successful, the identical head SHA and the identical checked-out merge SHA recorded in the run title. It waits at most an hour for an existing run, never starts a build, and fails closed on API errors, revoked approval, stale revisions or missing results. Approval-label events and new pushes supersede prior PR work; unrelated labels cannot cancel a real build.

Full builds, desktop platforms and caches

The web job builds the release site once from the exact tested commit. It stages that output for Pages on public-repository main pushes and manual full CI runs on main. Deployment requires both the web build and the aggregate checks job to succeed, and checks main again before publishing so a superseded revision is skipped. A Pages artifact upload failure surfaces in deployment while desktop nightlies can continue. PR, scheduled, and documentation-only runs skip publication.

Full runs retain the complete Windows workspace suite, both Windows Clippy passes, Python/Node regressions and the opt-in harness. Windows checkouts keep core.autocrlf=true; Git attributes protect recorded evidence bytes. The build job stages the native-window lifecycle executable reported by Cargo during the workspace tests, so the desktop smoke job uses that build. A separate GitHub Windows desktop runs that normally opt-in test with DX12/FXC and a 180-second deadline. Zero tests or a nonzero exit fail, and only the owned process is killed on timeout. This checks frame delivery, window lifetimes and close cancellation, not endurance or physical input latency.

The macOS job runs the Rust workspace suite, including the desktop launcher and app title-bar tests. Visual and pointer-interaction checks on a macOS desktop still require a separate run.

The Cargo ci profile retains assertions and overflow checks, disables incremental builds, and uses reduced debug metadata with optimized dependencies. Shipping release and ordinary development profiles are unchanged. Platforms have separate cache keys, and only main saves caches. Linux quick and native checks share a cache. The native, browser, and WASI jobs cache compiled dependencies and omit workspace crate outputs so more targets can fit in the repository's cache storage. A cache miss requires a cold build. In full CI, the Linux, Windows and macOS test jobs each have 150 minutes for compilation, tests and cache upload. The affected-package Linux job on approved PRs has 45 minutes. The default runners are ubuntu-latest, windows-latest and macos-latest. CI_RUNNER, CI_RUNNER_WINDOWS and CI_RUNNER_MACOS select provisioned runners. Custom Windows builds must be x64 MSVC executables compatible with the presenting windows-latest desktop. CI_BUILD_JOBS defaults to four on Linux, and CI_BUILD_JOBS_WINDOWS and CI_BUILD_JOBS_MACOS default to two.

Evidence and scope

The previous baseline run took 35.4 minutes on Windows and 20.2 minutes for Linux checks. The initial staged quick compile job passed in 3m28s without a restored cache, while expensive jobs were skipped. Its old approval-required error is removed by this revision. These observations are not a controlled full-build comparison; Windows full-build runtime remains an unresolved cost for the broad suite.

This work is separate from the investigation/container work in #399. Policy tests cover stages, package consumers, label changes, unknown inputs, strict completion and exact-revision reuse. Actual full Windows desktop qualification requires a full hosted run; local Linux results do not establish it.

The desktop builds guide covers the manual preview workflow and the standalone Nightly workflow. Nightly builds and publishes desktop packages from main independently of the full CI suite.

Versioned releases use the standalone Release PCBcraft workflow. It selects and pins the current release commit, tests the native workspace on all three Blacksmith platforms, builds the packages and stages or publishes only when all those jobs pass. Release branch pushes do not trigger a duplicate CI run, and CI does not stage releases or gate that workflow. The release tests do not run the desktop-only Windows window presentation smoke test. See Releasing PCBcraft for versioning and publication.