From c0771fe72b57a743bffdb3b218f7a006881650f7 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sat, 21 Nov 2026 00:07:08 +0700 Subject: [PATCH] Build the CI archive driver without framework-only lint dependencies (#15963) * Use the document mutator in the damage-history fixture * Compile the archive driver without framework-only lint dependencies --------- Co-authored-by: FredApps --- .cargo/config.toml | 2 ++ .github/workflows/ci.yml | 8 ++++---- xtask/Cargo.toml | 8 ++++++-- xtask/src/main.rs | 29 +++++++++++++++++++++++++++-- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 11a0baa22e..9cb335b70a 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,7 @@ [alias] xtask = "run -p xtask --" +# Archive and doctest jobs do not need the framework's lockfile and translation checks. +xtask-gate = "run --locked -p xtask --no-default-features -- ci" # wgpu's GL backend (glutin_wgl_sys) imports opengl32.dll, so every binary that links wgpu loads # it at start, and a process that has loaded it takes about 60 ms longer to exit (#15444): every diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 196a421ca2..0baaa06b08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -192,8 +192,8 @@ jobs: # missing-translations report (`cargo xtask ci lint`, xtask/src/main.rs), and the CI scripts' # own tests. lint-command: python3 scripts/test-ci-gpu-lavapipe.py && python3 scripts/test-ci-windows-gpu-tests.py && python3 scripts/test-ci-test-times.py && cargo xtask ci lint - archive-command: cargo xtask ci archive --gpu-shard - after-archive-command: cargo xtask ci doctest + archive-command: cargo xtask-gate archive --gpu-shard + after-archive-command: cargo xtask-gate doctest test-shards: 4 shard-archives: true # The tests and panic_hunt with `--locked --features heif` (TEST_TARGETS in xtask/src/main.rs). @@ -243,8 +243,8 @@ jobs: PHOTOCRAFT_CI_EXCLUDE=photocraft-web photocraft-web-boot ${{ needs.platforms.outputs.windows_gpu == 'false' && 'photocraft-gpu' || '' }} ${{ needs.platforms.outputs.windows_skip }} timeout-minutes: 100 lint-command: cargo xtask ci clippy - archive-command: cargo xtask ci archive - after-archive-command: cargo xtask ci doctest + archive-command: cargo xtask-gate archive + after-archive-command: cargo xtask-gate doctest test-shards: 6 shard-archives: true shard-command: bash scripts/ci-test-shard.sh diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 38416ab1fc..d4180ecf72 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -8,6 +8,10 @@ publish = false [lints] workspace = true +[features] +default = ["framework-checks"] +framework-checks = ["dep:craft", "dep:craft-i18n"] + [dependencies] serde_json = { workspace = true } serde = { workspace = true } @@ -15,9 +19,9 @@ chrono = { workspace = true } # perf/budgets.toml and scorecard/*.toml (MIT OR Apache-2.0). toml = "1" # `i18n-report` looks the UI strings up in the craft-i18n catalogs as the app does. -craft-i18n = { workspace = true } +craft-i18n = { workspace = true, optional = true } # `egui-fork` checks Cargo.lock against `craft::egui_fork`. -craft = { workspace = true } +craft = { workspace = true, optional = true } [dev-dependencies] tempfile = "3" diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 73a9fc8f6d..4d85f68b64 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -7,6 +7,7 @@ mod cache_units; mod cargo_env; mod corpus; mod corpus_pins; +#[cfg(feature = "framework-checks")] mod i18n_report; mod ico; mod layers; @@ -95,7 +96,7 @@ fn main() -> ExitCode { Some("test-corpus") => corpus::test_cmd(&rest), Some("stats") => stats::run(&root(), rest.contains(&"--exact")), Some("parity") => cmd_parity(), - Some("i18n-report") => i18n_report::run(&root()), + Some("i18n-report") => cmd_i18n_report(), Some("perf") => perf::run(&root(), &rest), Some("scorecard") => scorecard::run(&root(), &rest), Some("version") => version::run(&root(), &rest), @@ -151,6 +152,7 @@ pub fn target_dir() -> Result { /// Two egui revisions in one build give two incompatible `Ui` types, so the workspace's egui /// `[patch]` must name the revision the craft framework is built with. +#[cfg(feature = "framework-checks")] fn cmd_egui_fork() -> Result<(), String> { let path = root().join("Cargo.lock"); let lock = std::fs::read_to_string(&path).map_err(|e| format!("{}: {e}", path.display()))?; @@ -159,6 +161,29 @@ fn cmd_egui_fork() -> Result<(), String> { Ok(()) } +#[cfg(feature = "framework-checks")] +fn cmd_i18n_report() -> Result<(), String> { + i18n_report::run(&root()) +} + +// An explicitly minimal xtask can still run either check when asked for it. +#[cfg(not(feature = "framework-checks"))] +fn run_framework_check(name: &str) -> Result<(), String> { + let mut c = cargo(); + c.args(["run", "--locked", "-p", "xtask", "--features", "framework-checks", "--", name]); + run(c, name) +} + +#[cfg(not(feature = "framework-checks"))] +fn cmd_egui_fork() -> Result<(), String> { + run_framework_check("egui-fork") +} + +#[cfg(not(feature = "framework-checks"))] +fn cmd_i18n_report() -> Result<(), String> { + run_framework_check("i18n-report") +} + fn cmd_layers() -> Result<(), String> { let crates = layers::from_metadata(&metadata()?)?; println!("Dependency layering (docs/architecture.md ยง3)\n"); @@ -364,7 +389,7 @@ fn step_doctest(o: &CiOptions) -> Result<(), String> { fn step_i18n(_: &CiOptions) -> Result<(), String> { // Lists missing translations for the log; a missing string shows in English, so it never fails CI. - if let Err(e) = i18n_report::run(&root()) { + if let Err(e) = cmd_i18n_report() { eprintln!("warning: i18n report failed: {e}"); } Ok(())