Skip to content

Commit ae1f30e

Browse files
committed
perf: dogfood pipeline uses shared apt-base + warmup for faster CI
- Single apt-get call shared across Rust and Python toolchains - warmup() pre-compiles workspace; test/clippy reuse artifacts - fmt stays off installed for parallel execution
1 parent 53d7e75 commit ae1f30e

2 files changed

Lines changed: 56 additions & 14 deletions

File tree

.harmont/ci.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,30 @@
55
from harmont.py.uv import UvProject
66
from harmont.rust import RustToolchain
77

8+
ALL_APT = (
9+
"curl",
10+
"ca-certificates",
11+
"build-essential",
12+
"pkg-config",
13+
"libssl-dev",
14+
"python3",
15+
"python3-venv",
16+
)
17+
18+
19+
@hm.target()
20+
def shared_base() -> hm.Step:
21+
return hm.apt_base(packages=ALL_APT)
22+
823

924
@hm.target()
10-
def rust_project() -> RustToolchain:
11-
return hm.rust(path=".")
25+
def rust_project(shared_base: hm.Target[hm.Step]) -> RustToolchain:
26+
return hm.rust(path=".", base=shared_base)
1227

1328

1429
@hm.target()
15-
def py_project() -> UvProject:
16-
return hm.py.uv(path="dsls/harmont-py")
30+
def py_project(shared_base: hm.Target[hm.Step]) -> UvProject:
31+
return hm.py.uv(path="dsls/harmont-py", base=shared_base)
1732

1833

1934
@hm.pipeline(
@@ -29,13 +44,16 @@ def ci(
2944
rust_project: hm.Target[RustToolchain],
3045
py_project: hm.Target[UvProject],
3146
) -> tuple[hm.Step, ...]:
47+
warm = rust_project.warmup()
3248
return (
33-
rust_project.build(),
34-
rust_project.installed.sh(
35-
". $HOME/.cargo/env && cd . && cargo test --lib",
49+
warm.sh(
50+
". $HOME/.cargo/env && cd . && cargo test --workspace --locked --no-fail-fast",
3651
label=":rust: test",
3752
),
38-
rust_project.clippy(),
53+
warm.sh(
54+
". $HOME/.cargo/env && cd . && cargo clippy --workspace --tests --locked -- -D warnings",
55+
label=":rust: clippy",
56+
),
3957
rust_project.fmt(),
4058
py_project.lint(),
4159
py_project.fmt(),

.harmont/ci.ts

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
1-
import { pipeline, push, pullRequest, type PipelineDefinition } from "harmont";
1+
import {
2+
pipeline,
3+
push,
4+
pullRequest,
5+
aptBase,
6+
type PipelineDefinition,
7+
} from "harmont";
28
import { rust, py } from "harmont/toolchains";
39

4-
const rustProject = rust({ path: "." });
5-
const pyProject = py.uv({ path: "dsls/harmont-py" });
10+
const ALL_APT = [
11+
"curl",
12+
"ca-certificates",
13+
"build-essential",
14+
"pkg-config",
15+
"libssl-dev",
16+
"python3",
17+
"python3-venv",
18+
] as const;
19+
20+
const base = aptBase({ packages: ALL_APT });
21+
const rustProject = rust({ path: ".", base });
22+
const pyProject = py.uv({ path: "dsls/harmont-py", base });
23+
24+
const warm = rustProject.warmup();
625

726
const pipelines: PipelineDefinition[] = [
827
{
928
slug: "ci",
1029
triggers: [push({ branch: "main" }), pullRequest({ branches: ["main"] })],
1130
pipeline: pipeline(
12-
rustProject.build(),
13-
rustProject.install().sh(`. $HOME/.cargo/env && cd . && cargo test --lib`, { label: ":rust: test" }),
14-
rustProject.clippy(),
31+
warm.sh(
32+
`. $HOME/.cargo/env && cd . && cargo test --workspace --locked --no-fail-fast`,
33+
{ label: ":rust: test" },
34+
),
35+
warm.sh(
36+
`. $HOME/.cargo/env && cd . && cargo clippy --workspace --tests --locked -- -D warnings`,
37+
{ label: ":rust: clippy" },
38+
),
1539
rustProject.fmt(),
1640
pyProject.lint(),
1741
pyProject.fmt(),

0 commit comments

Comments
 (0)