mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 20:14:31 +01:00
Merge remote-tracking branch 'upstream/next' into next-sync-1125
This commit is contained in:
commit
c136195d93
11 files changed
+61
-25
No files matched your search
@@ -29,3 +29,9 @@ opt-level = 1
|
||||
|
||||
[profile.dev.package.craft-cms]
|
||||
opt-level = 1
|
||||
|
||||
# The runtime under every screen test: each frame of a fixture runs its pass, layout, focus and access tree. At
|
||||
# opt-level 2 a suite trial runs about 40 percent fewer instructions than at 0 (Table activation 19.8 G to 11.9 G);
|
||||
# opt-level 1 gives about 30 percent. Every UI crate waits for its compile, which grows by about a minute.
|
||||
[profile.dev.package.craft-ui-contract]
|
||||
opt-level = 2
|
||||
@@ -167,8 +167,8 @@ jobs:
|
||||
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
||||
# A selection that reaches a replay-audit crate builds once in a `build` job, which writes
|
||||
# three nextest archives and then runs the doctests; three shard legs run them in parallel:
|
||||
# every selected test outside the replay audit's crates, those crates (run plainly, then with the
|
||||
# audit), and craft-image-codecs with default features. Any other selection
|
||||
# every selected test outside the replay audit's crates and craft-draw, those crates (run plainly,
|
||||
# then the audit crates with the audit), and craft-image-codecs with default features. Any other selection
|
||||
# (and every macOS and Windows leg) builds and runs in one leg. scripts/ci-workspace-tests.sh
|
||||
# holds every step.
|
||||
test-shards: ${{ needs.platforms.outputs.audit == 'true' && 3 || 0 }}
|
||||
|
||||
@@ -717,7 +717,7 @@ fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() {
|
||||
let band = |group: u64| fixture.part_rect(id, GRIP.at(group)).expect("each group keeps a grip band");
|
||||
let (first, last, next) = (cell(0), cell(1), cell(2));
|
||||
let (top, lower) = (band(0), band(1));
|
||||
assert!(first.top() < gripped_first.top() - 0.5, "the first icon {first:?} stands higher than under a grip strip {gripped_first:?}");
|
||||
assert!(first.top() < gripped_first.top(), "the first icon {first:?} stands higher than under a grip strip {gripped_first:?}");
|
||||
for (group, band) in [top, lower].into_iter().enumerate() {
|
||||
assert!(grip_ticks(&shapes, band).is_none(), "group {group}: the band shows no marks");
|
||||
}
|
||||
@@ -733,7 +733,7 @@ fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() {
|
||||
let between: Vec<_> = level.iter().filter(|(a, _, _)| a.y > last.bottom() && a.y < next.top()).collect();
|
||||
let [(a, b, ink)] = between.as_slice() else { panic!("one rule between the groups: {level:?}") };
|
||||
let middle = (last.bottom() + next.top()) / 2.0;
|
||||
assert!((a.y - middle).abs() <= 0.5, "the rule {a:?} lies in the middle of the room from {last:?} to {next:?}");
|
||||
assert!(near(a.y, middle), "the rule {a:?} lies in the middle of the room from {last:?} to {next:?}");
|
||||
let (left, right) = (a.x.min(b.x), a.x.max(b.x));
|
||||
let span = right - left;
|
||||
assert!(left > 0.0 && right < RAIL && span > RAIL - span, "the rule reaches across the column, short of its sides: {a:?} to {b:?}");
|
||||
|
||||
@@ -878,7 +878,7 @@ impl StartScreen<'_> {
|
||||
column_links(&page, ui, links_title.as_ref(), links);
|
||||
});
|
||||
});
|
||||
ui.allocate_space(vec2(0.0, margin));
|
||||
ui.add_space(env.tokens.size.page.margin);
|
||||
});
|
||||
return StartOutput { response: shown.output, actions: actions.into_inner() };
|
||||
}
|
||||
|
||||
@@ -211,9 +211,9 @@ fn page_templates() -> Vec<Template> {
|
||||
/// The links of the Column stories: a call to action and two plain links.
|
||||
fn column_links() -> [StartLink; 3] {
|
||||
[
|
||||
StartLink::url("Join the community", Some(IconId::new("message-circle")), "https://example.com/chat").primary(),
|
||||
StartLink::url("Join the community", Some(IconId::new("note")), "https://example.com/chat").primary(),
|
||||
StartLink::url("Website", Some(IconId::new("globe")), "https://example.com"),
|
||||
StartLink::url("Source code", Some(IconId::new("git-branch")), "https://example.com/source"),
|
||||
StartLink::url("Source code", Some(IconId::new("open")), "https://example.com/source"),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ pub struct TileStyle {
|
||||
}
|
||||
|
||||
/// The paper of a page picture (`Tile::page`): a document's blank page, which is data, not a theme surface.
|
||||
const PAPER: DataColor = DataColor::new(Color32::WHITE);
|
||||
const PAPER: DataColor = DataColor::new(Color32::WHITE); // design: allow[raw-colour/const](a document's blank page is data, not a theme surface)
|
||||
|
||||
/// A `width` by `height` page centred in `picture` on the knob's shadow, the theme's short hard shadow of a part lifted
|
||||
/// just off the surface under it. The page's longer side spans the largest square the picture holds with the shadow,
|
||||
@@ -554,6 +554,7 @@ impl<'a> Tile<'a> {
|
||||
/// that stands for a document size shows it this way (New Document's presets in `PresetCardLook::Page`, a start
|
||||
/// page's page templates).
|
||||
#[must_use]
|
||||
// design: allow[props/point-size](only the page's shape counts: `width` and `height` are a proportion in any one unit)
|
||||
pub fn page(self, width: f64, height: f64) -> Self {
|
||||
self.flat_thumbnail().thumb(ThumbAspect::new(2, 1), move |cx: &ContentPainterCx<'_>, picture: Rect| paint_page(cx, picture, width, height))
|
||||
}
|
||||
|
||||
@@ -1 +1,17 @@
|
||||
config_version = 1
|
||||
|
||||
[[exception]]
|
||||
name = "tile-page-paper-white"
|
||||
kind = "marker"
|
||||
rule = "raw-colour/const"
|
||||
path = "crates/ui-widgets/src/tile_grid/tile.rs"
|
||||
reason = "A page picture's paper is a document's blank page, which is data (`DataColor`), not a theme surface."
|
||||
count = 1
|
||||
|
||||
[[exception]]
|
||||
name = "tile-page-proportion"
|
||||
kind = "marker"
|
||||
rule = "props/point-size"
|
||||
path = "crates/ui-widgets/src/tile_grid/tile.rs"
|
||||
reason = "`Tile::page` takes a page's width and height in any one unit: only their proportion counts, never a size in points."
|
||||
count = 1
|
||||
@@ -64,7 +64,7 @@ Grouped by gallery level, then shape, then name.
|
||||
| `Disclosure` | Leaf | `craft_ui_widgets::controls::disclosure` | A button bound to an open state, with the expanded state |
|
||||
| `IconButton` | Leaf | `craft_ui_widgets::buttons::icon_button` | A square button showing only an icon |
|
||||
| `Kbd` | Leaf | `craft_ui_widgets::display::kbd` | A key chord |
|
||||
| `Link` | Leaf | `craft_ui_widgets::buttons::link` | A link: drawn in the accent colour in a type role (body by default) and underlined, so colour is not its only cue |
|
||||
| `Link` | Leaf | `craft_ui_widgets::buttons::link` | A link: drawn in the accent colour in a type role (body by default) and underlined, so colour is not its only cue (`LinkLook::Plain` drops the underline of a link standing alone) |
|
||||
| `LinkedFields` | Leaf | `craft_ui_widgets::text::linked` | `N` number fields joined by a link toggle |
|
||||
| `NumberField` | Leaf | `craft_ui_widgets::text::number` | A number field: a text part over [`NumberCodec`]; empty text is `None` |
|
||||
| `PointPicker` | Leaf | `craft_ui_widgets::value_drag::point_picker` | A point `[x, y]` picked on a well: x grows to the right and y downwards, as image coordinates do, in either reading direction |
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
# run one leg builds and runs every test: each macOS and Windows leg, and the Linux leg when
|
||||
# the selection reaches no replay-audit crate
|
||||
# archive the Linux build job (gate.yml `archive-command`) builds once and writes one nextest
|
||||
# archive per shard: 1 every selected test outside the replay audit's crates, 2 those
|
||||
# crates, 3 the default-feature crate
|
||||
# shard a Linux shard leg runs its archive ($GATE_SHARD); shard 2 runs it plainly, then with
|
||||
# the audit on
|
||||
# archive per shard: 1 every selected test outside the replay audit's crates and the
|
||||
# crates shard 2 also takes, 2 those crates, 3 the default-feature crate
|
||||
# shard a Linux shard leg runs its archive ($GATE_SHARD); shard 2 runs it plainly, then the
|
||||
# audit crates' tests again with the audit on
|
||||
# doctest the doctests, in the build job after the archives (`after-archive-command`)
|
||||
# audit prints whether the selection reaches a replay-audit crate (`true` or `false`)
|
||||
# full the nightly run: every test, at the full sweep and proptest counts nightly.yml leaves set
|
||||
@@ -34,10 +34,15 @@ default_features=(-p craft-image-codecs --locked --profile ci "${config[@]}")
|
||||
audit_packages=(craft-ui-contract craft-ui-widgets craft-ui-panels craft-ui-patterns craft-ui-shell craft-ui-gallery craft-menu)
|
||||
audit_crates=$(printf ' | package(%s)' "${audit_packages[@]}")
|
||||
audit_crates=${audit_crates:3}
|
||||
# Crates outside the audit whose tests shard 2 runs too (plainly only), so that shards 1 and 2 end
|
||||
# together: shard 1 holds the other UI crates and every non-UI test.
|
||||
shard_2_packages=(craft-draw)
|
||||
shard_2_crates=$audit_crates$(printf ' | package(%s)' "${shard_2_packages[@]}")
|
||||
filter=${CRAFT_TEST_FILTER:-all()}
|
||||
# Shard 1 leaves the audit crates to shard 2, which runs them plainly and with the audit on.
|
||||
plain_filter="($filter) & !($audit_crates)"
|
||||
audit_filter="($filter) & ($audit_crates)"
|
||||
# Shard 1 leaves the audit crates and shard 2's own to shard 2, which runs them plainly and then
|
||||
# the audit crates with the audit on.
|
||||
plain_filter="($filter) & !($shard_2_crates)"
|
||||
shard_2_filter="($filter) & ($shard_2_crates)"
|
||||
|
||||
doctests() {
|
||||
# Whole-workspace: `cargo test -p <selected>` would resolve features over the selected crates
|
||||
@@ -65,9 +70,9 @@ case "${1:-}" in
|
||||
# The examples' two packages join the one build here, so their tests are in shard 1's archive.
|
||||
cargo nextest archive "${all_features[@]}" "${targets[@]}" --example stubicc --example h264_h264enc_bench \
|
||||
-E "$plain_filter" --archive-file "$NEXTEST_ARCHIVE_DIR/1/$NEXTEST_ARCHIVE_NAME"
|
||||
# The same build, so nothing compiles again; only the audit crates' binaries.
|
||||
# The same build, so nothing compiles again; only shard 2's crates' binaries.
|
||||
cargo nextest archive "${all_features[@]}" "${targets[@]}" --example stubicc --example h264_h264enc_bench \
|
||||
-E "$audit_filter" --archive-file "$NEXTEST_ARCHIVE_DIR/2/$NEXTEST_ARCHIVE_NAME"
|
||||
-E "$shard_2_filter" --archive-file "$NEXTEST_ARCHIVE_DIR/2/$NEXTEST_ARCHIVE_NAME"
|
||||
cargo nextest archive "${default_features[@]}" "${targets[@]}" \
|
||||
-E "$filter" --archive-file "$NEXTEST_ARCHIVE_DIR/3/$NEXTEST_ARCHIVE_NAME"
|
||||
;;
|
||||
@@ -75,7 +80,7 @@ case "${1:-}" in
|
||||
run=(cargo nextest run --archive-file "$NEXTEST_ARCHIVE_FILE" --workspace-remap . --profile ci --no-tests=warn)
|
||||
case "${GATE_SHARD:-}" in
|
||||
1 | 3) "${run[@]}" ;;
|
||||
2) "${run[@]}"; CRAFT_UI_AUDIT_REPLAY=1 "${run[@]}" ;;
|
||||
2) "${run[@]}"; CRAFT_UI_AUDIT_REPLAY=1 "${run[@]}" -E "$audit_crates" ;;
|
||||
*) echo "unknown shard: '${GATE_SHARD:-}'" >&2; exit 2 ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
@@ -114,6 +114,7 @@ EXAMPLES = "--example stubicc --example h264_h264enc_bench"
|
||||
AUDIT_PACKAGES = ("craft-ui-contract", "craft-ui-widgets", "craft-ui-panels", "craft-ui-patterns",
|
||||
"craft-ui-shell", "craft-ui-gallery", "craft-menu")
|
||||
AUDIT = " | ".join(f"package({name})" for name in AUDIT_PACKAGES)
|
||||
SHARD_2 = AUDIT + " | package(craft-draw)"
|
||||
DOCTESTS = f"test --workspace --doc --all-features --locked {CONFIG}"
|
||||
|
||||
|
||||
@@ -129,9 +130,9 @@ def run_commands(test_filter="all()"):
|
||||
|
||||
def archive_commands(directory, test_filter="all()"):
|
||||
return [
|
||||
f"nextest archive {ALL} {TARGETS} {EXAMPLES} -E ({test_filter}) & !({AUDIT}) "
|
||||
f"nextest archive {ALL} {TARGETS} {EXAMPLES} -E ({test_filter}) & !({SHARD_2}) "
|
||||
f"--archive-file {directory}/1/a.tar.zst",
|
||||
f"nextest archive {ALL} {TARGETS} {EXAMPLES} -E ({test_filter}) & ({AUDIT}) "
|
||||
f"nextest archive {ALL} {TARGETS} {EXAMPLES} -E ({test_filter}) & ({SHARD_2}) "
|
||||
f"--archive-file {directory}/2/a.tar.zst",
|
||||
f"nextest archive {DEFAULT} {TARGETS} -E {test_filter} --archive-file {directory}/3/a.tar.zst",
|
||||
]
|
||||
@@ -196,11 +197,12 @@ class WorkspaceTests(unittest.TestCase):
|
||||
|
||||
def test_each_shard_runs_its_archive_and_shard_2_also_audits(self):
|
||||
expected = "nextest run --archive-file /a/b.tar.zst --workspace-remap . --profile ci --no-tests=warn"
|
||||
for shard, prefixes in (("1", [""]), ("2", ["", "AUDIT "]), ("3", [""])):
|
||||
# Shard 2 audits only the audit crates of its archive.
|
||||
for shard, lines in (("1", [expected]), ("2", [expected, f"AUDIT {expected} -E {AUDIT}"]), ("3", [expected])):
|
||||
with self.subTest(shard=shard):
|
||||
result, _ = step("shard", GATE_SHARD=shard, NEXTEST_ARCHIVE_FILE="/a/b.tar.zst")
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(result.stdout.splitlines(), [prefix + expected for prefix in prefixes])
|
||||
self.assertEqual(result.stdout.splitlines(), lines)
|
||||
result, _ = step("shard", GATE_SHARD="4", NEXTEST_ARCHIVE_FILE="/a/b.tar.zst")
|
||||
self.assertEqual(result.returncode, 2)
|
||||
self.assertEqual(result.stdout, "")
|
||||
|
||||
@@ -94,6 +94,8 @@ APP_KEYS = {
|
||||
"test_threads": (int, None),
|
||||
}
|
||||
APP_BUILDING = {"test", "check", "build", "run", "bench", "clippy", "doc", "rustc"}
|
||||
# cargo's own subcommands that resolve a profile; `cargo()` passes the dev settings after them.
|
||||
CARGO_BUILDING = {"test", "check", "build", "run", "bench", "doc", "rustc", "metadata", "tree"}
|
||||
APP_FEATURE_FLAGS = ("--features", "-F", "--no-default-features")
|
||||
# Set by main() from the workspace's `[workspace.metadata.cl]` in an app workspace; None in craft-libs.
|
||||
APP = None
|
||||
@@ -379,9 +381,13 @@ def cargo(top, cargo_args, json_out=False, timings=True):
|
||||
RECORD["target"] = target
|
||||
if timings:
|
||||
cargo_args = cargo_args[:1] + ["--timings"] + cargo_args[1:]
|
||||
# An app workspace keeps its own profile settings.
|
||||
# An app workspace keeps its own profile settings. For cargo's own build commands they go after the subcommand:
|
||||
# cargo lets a `--config` given there replace every `--config` given before it, so a caller's own `--config`
|
||||
# (.config/cargo-ci.toml) would otherwise drop the dev settings and build every crate, dependencies included, at
|
||||
# opt-level 0. An external subcommand (fmt) would read them as its own options, so they stay before it.
|
||||
config = [] if APP else [x for c in dev_profile_config() for x in ("--config", c)]
|
||||
cmd = shlex.split(env.get("CL_LAUNCHER", "")) + ["cargo"] + config + cargo_args
|
||||
split = 1 if cargo_args[:1] and cargo_args[0] in CARGO_BUILDING else 0
|
||||
cmd = shlex.split(env.get("CL_LAUNCHER", "")) + ["cargo"] + cargo_args[:split] + config + cargo_args[split:]
|
||||
print("cl: " + " ".join(cmd) + f" (target {target})", file=sys.stderr)
|
||||
sys.stdout.flush()
|
||||
if DRY_RUN:
|
||||
|
||||
Reference in new issue
Block a user