Merge pull request #10975 from dotCooCoo/fix/ci-lint-cache

CI: build the tests without bundled fonts in the build job, not the lint leg
This commit is contained in:
.CooCoo authored and GitHub committed 2026-12-05 14:09:21 -08:00
commit 29927c6df2
3 files changed
+76 -26

No files matched your search

+9 -7
View File
@@ -44,17 +44,19 @@ jobs:
# The workspace crates also build without line tables. A panic still names its file and line.
dev-debug: "0"
# The `build (<os>)` job builds the tests once and writes one nextest archive per shard with
# that shard's test binaries (`cargo xtask ci archive`), then runs the doctests. Five test
# legs download their own archive and run it without building: shards 1 and 2 each run half
# of vectorcraft-ui-egui's tests, and shards 3 to 5 the tests of their own crates
# (xtask/src/shards.rs). The `lint (<os>)` leg runs the other `cargo xtask ci` steps beside
# them, with a dependency cache of its own. `gate (<os>)` passes when the build and every
# test leg that ran passed; `lint (<os>)` is a check of its own.
# that shard's test binaries (`cargo xtask ci archive`), then runs the doctests and the tests
# built without the bundled fonts (`cargo xtask ci after-archive`), whose second build of the
# workspace crates the build job's cache entry keeps. Five test legs download their own archive and
# run it without building: shards 1 and 2 each run half of vectorcraft-ui-egui's tests, and
# shards 3 to 5 the tests of their own crates (xtask/src/shards.rs). The `lint (<os>)` leg
# runs the other `cargo xtask ci` steps beside them, with a dependency cache of its own.
# `gate (<os>)` passes when the build and every test leg that ran passed; `lint (<os>)` is a
# check of its own.
test-shards: 5
shard-command: cargo xtask ci shard
archive-command: cargo xtask ci archive
shard-archives: true
after-archive-command: cargo xtask ci doctests
after-archive-command: cargo xtask ci after-archive
lint-command: cargo xtask ci checks
# A pull request runs only the test shards whose crates its changes reach: the crates that
# own a changed file or declare a read of it (`[package.metadata.craft] reads`), and every
+4 -2
View File
@@ -227,8 +227,10 @@ context. It replaces the context's font definitions, so an embedder's own faces
- `cargo test -p vectorcraft-text --no-default-features --test without_bundled_fonts` checks the
configuration without them, and `cargo test -p vectorcraft-ui-egui --no-default-features --test
install_fonts` that the fonts `embed::install` sets up bind the proportional, monospace and
semibold families, so an effect dialog draws; the same step lints `vectorcraft-ui-egui` without
its default features.
semibold families, so an effect dialog draws. `cargo xtask ci` runs these two tests in its
`no-bundled-fonts-tests` step, and its `no-bundled-fonts` step also lints `vectorcraft-ui-egui`
without its default features. In CI the gate's `build` job runs the tests (`cargo xtask ci
after-archive`) and the `lint` leg runs the rest (`cargo xtask ci checks`).
### Arabic fonts and the web build
+63 -17
View File
@@ -49,7 +49,7 @@ commands:
layers enforce the crate dependency layering (plan/architecture.md §3)
wasm cargo check --target wasm32-unknown-unknown for the wasm-safe crates, the web app and its plug-in worker
test the workspace tests (cargo nextest when installed, else cargo test), then the doctests
ci fmt --check, clippy -D warnings, test, doctests, no-bundled-fonts, pdf-deps, assets, brands, grant-sites, cursors (warnings only), test-lint, ui-commands --check, layers, wasm (stops at first failure)
ci fmt --check, clippy -D warnings, test, doctests, no-bundled-fonts, no-bundled-fonts-tests, pdf-deps, assets, brands, grant-sites, cursors (warnings only), test-lint, ui-commands --check, layers, wasm (stops at first failure)
ci shard shard $GATE_SHARD of $GATE_SHARDS of ci's tests (xtask/src/shards.rs): from the
nextest archive in $NEXTEST_ARCHIVE_FILE when set, otherwise it builds them and
also runs the doctests of its crates
@@ -57,7 +57,11 @@ commands:
$NEXTEST_ARCHIVE_DIR/<k>/$NEXTEST_ARCHIVE_NAME for k from 1 to $GATE_SHARDS; with
CRAFT_CACHE_UNITS set, appends Cargo's JSON messages for the build to that file
ci doctests the doctests of each shard's crates, one cargo command per shard
ci checks the ci steps other than the tests, the doctests and the i18n report
ci after-archive
ci doctests, then the tests built without the bundled fonts
(no-bundled-fonts-tests), for the gate's build job
ci checks the ci steps other than the tests, the doctests, the i18n report and
no-bundled-fonts-tests
shards list the crates each shard tests; fails when a member is in no shard or in two,
or builds with other features in its shard than in the whole workspace
corpus [--download | --affinity | --scripts]
@@ -100,6 +104,7 @@ fn main() -> ExitCode {
Some("ci") if rest.first() == Some(&"shard") => cmd_ci_shard(),
Some("ci") if rest.first() == Some(&"archive") => cmd_ci_archive(),
Some("ci") if rest.first() == Some(&"doctests") => cmd_ci_doctests(),
Some("ci") if rest.first() == Some(&"after-archive") => cmd_ci_after_archive(),
Some("ci") if rest.first() == Some(&"checks") => cmd_ci_checks(),
Some("ci") => cmd_ci(),
Some("shards") => shards::run().map(drop),
@@ -541,8 +546,8 @@ fn test_build(r: &shards::Run, units: bool) -> (Command, String) {
}
/// `cargo xtask ci doctests`: the doctests of each shard's crates, one cargo command per shard
/// with the crates `ci shard` runs them for, after `ci archive` (the shared gate's
/// `after-archive-command`). Every command runs before the first error is returned.
/// with the crates `ci shard` runs them for, after `ci archive`. Every command runs before the
/// first error is returned.
fn cmd_ci_doctests() -> Result<(), String> {
let mut result = Ok(());
for s in shards::assigned()?.iter().filter(|s| s.part.is_none_or(|p| p.is_first())) {
@@ -551,10 +556,32 @@ fn cmd_ci_doctests() -> Result<(), String> {
result
}
/// `cargo xtask ci checks`: every `ci` step other than [`TEST_STEPS`], for the shared gate's
/// `lint` leg.
/// The `ci` steps that `ci after-archive` runs in the gate's `build` job, whose cache entry keeps
/// the workspace crates they build without the bundled fonts; `ci checks` leaves them out.
const BUILD_JOB_STEPS: [&str; 1] = ["no-bundled-fonts-tests"];
/// `cargo xtask ci after-archive`: the shared gate's `after-archive-command`. It runs `ci
/// doctests`, then the [`BUILD_JOB_STEPS`].
fn cmd_ci_after_archive() -> Result<(), String> {
run_steps(&after_archive_steps())
}
/// The steps of [`cmd_ci_after_archive`].
fn after_archive_steps() -> Vec<Step> {
let mut steps: Vec<Step> = vec![("doctests", Box::new(cmd_ci_doctests))];
steps.extend(ci_steps().into_iter().filter(|(name, _)| BUILD_JOB_STEPS.contains(name)));
steps
}
/// `cargo xtask ci checks`: every `ci` step other than [`TEST_STEPS`] and [`BUILD_JOB_STEPS`], for
/// the shared gate's `lint` leg.
fn cmd_ci_checks() -> Result<(), String> {
run_steps(&ci_steps().into_iter().filter(|(name, _)| !TEST_STEPS.contains(name)).collect::<Vec<_>>())
run_steps(&checks_steps())
}
/// The steps of [`cmd_ci_checks`].
fn checks_steps() -> Vec<Step> {
ci_steps().into_iter().filter(|(name, _)| !TEST_STEPS.contains(name) && !BUILD_JOB_STEPS.contains(name)).collect()
}
/// Runs `steps` in turn, stopping at the first that fails; the summary names the steps that passed
@@ -604,21 +631,28 @@ fn ci_steps() -> Vec<Step> {
(
"no-bundled-fonts",
Box::new(|| {
// vectorcraft-text as embedders that bring their own fonts build it.
let mut c = cargo();
c.args(["test", "-p", "vectorcraft-text", "--no-default-features", "--test", "without_bundled_fonts"]);
run(c, "cargo test -p vectorcraft-text --no-default-features --test without_bundled_fonts")?;
// The egui panels and the MCP server as such an embedder builds them: nothing turns
// the fonts back on.
// The egui panels and the MCP server as an embedder that brings its own fonts
// builds them: nothing turns the fonts back on.
libraries_without_bundled_fonts()?;
// The panels without their interface faces lint clean and still bind every family
// they draw in.
// The panels without their interface faces lint clean.
let mut c = cargo();
c.args(["clippy", "-p", "vectorcraft-ui-egui", "--no-default-features", "--all-targets", "--", "-D", "warnings"]);
run(c, "cargo clippy -p vectorcraft-ui-egui --no-default-features --all-targets -- -D warnings")?;
run(c, "cargo clippy -p vectorcraft-ui-egui --no-default-features --all-targets -- -D warnings")
}),
),
(
"no-bundled-fonts-tests",
Box::new(|| {
// vectorcraft-text as such an embedder builds it, and the panels without their
// interface faces still bind every family they draw in. In a leg that saves the
// cache the builds record their units (xtask/src/cache_units.rs), so the entry
// keeps the workspace crates built without the fonts.
let mut c = cargo();
c.args(["test", "-p", "vectorcraft-text", "--no-default-features", "--test", "without_bundled_fonts"]);
cache_units::run(c, "cargo test -p vectorcraft-text --no-default-features --test without_bundled_fonts")?;
let mut c = cargo();
c.args(["test", "-p", "vectorcraft-ui-egui", "--no-default-features", "--test", "install_fonts"]);
run(c, "cargo test -p vectorcraft-ui-egui --no-default-features --test install_fonts")
cache_units::run(c, "cargo test -p vectorcraft-ui-egui --no-default-features --test install_fonts")
}),
),
("pdf-deps", Box::new(|| pdf_deps::run(&root()))),
@@ -758,4 +792,16 @@ mod tests {
assert_eq!(archived.len(), shards::GROUPS.len());
assert!(archived.iter().zip(&real).all(|(r, s)| s.runs == [(*r).clone()]));
}
#[test]
fn the_build_job_runs_the_tests_without_bundled_fonts_and_the_lint_leg_the_rest() {
let names = |steps: Vec<Step>| steps.into_iter().map(|(name, _)| name).collect::<Vec<_>>();
assert_eq!(names(after_archive_steps()), ["doctests", "no-bundled-fonts-tests"]);
let checks = names(checks_steps());
assert!(checks.contains(&"no-bundled-fonts"), "{checks:?}");
assert!(!checks.contains(&"no-bundled-fonts-tests"), "{checks:?}");
let workflow = include_str!("../../.github/workflows/ci.yml");
assert!(workflow.contains("after-archive-command: cargo xtask ci after-archive\n"), "ci.yml's after-archive-command");
assert!(workflow.contains("lint-command: cargo xtask ci checks\n"), "ci.yml's lint-command");
}
}