Install a language, warm its cache, and run build/test/lint in one call.
A toolchain wraps three things: installing the runtime, warming the dependency cache, and the common build/test/lint commands. You call one factory, then attach the actions you want. Each action forks off the shared install step, so adding a check costs you the action — never the install.
Rust
hm.rust.toolchain() installs the toolchain; the action methods build, test,
lint, and format.
rust.toolchain(*, path='.', version='stable', image=None, components=('clippy', 'rustfmt'), base=None) -> RustToolchain| Parameter | Type | Default | Description |
|---|---|---|---|
path | str | '.' | Path to the crate or workspace root. |
version | str | 'stable' | rustup channel name (``"stable"``) or a pinned version (``"1.81.0"``). |
image | str | None | None | Local-mode Docker base image override. |
components | tuple[str, ...] | ('clippy', 'rustfmt') | rustup components to install alongside the toolchain. Defaults to ``("clippy", "rustfmt")``. |
base | Step | None | None | Existing ``Step`` to attach the toolchain install to instead of emitting a fresh apt-base step. Use to share one apt-base across multiple toolchains. |
import harmont as hm
@hm.pipeline("ci")
def ci() -> tuple[hm.Step, ...]:
project = hm.rust.toolchain(path=".")
return (project.build(), project.test(), project.clippy(), project.fmt())import { pipeline, type PipelineDefinition } from "@harmont/hm";
import { rust } from "@harmont/hm/toolchains";
const project = rust.toolchain({ path: "." });
const pipelines: PipelineDefinition[] = [
{ slug: "ci", pipeline: pipeline([project.build(), project.test(), project.clippy(), project.fmt()]) },
];
export default pipelines;CMake (C / C++)
hm.cmake() configures and builds with CMake. Pass compiler, defines, a
generator, or a preset; the action methods run CTest, clang-format, and
clang-tidy.
cmake(*, path='.', lang='c', image=None, base=None) -> CMakeProject| Parameter | Type | Default | Description |
|---|---|---|---|
path | str | '.' | Path to the project root (where ``CMakeLists.txt`` lives). |
lang | str | 'c' | Language tag, either ``"c"`` or ``"cpp"``. Affects label prefixes only; the cmake commands are identical. |
image | str | None | None | Local-mode Docker base image override. |
base | Step | None | None | Existing ``Step`` to attach to instead of emitting a fresh apt-base step. |
import harmont as hm
@hm.pipeline("ci")
def ci() -> tuple[hm.Step, ...]:
project = hm.cmake(
path=".",
compiler="clang-18",
defines={"CMAKE_BUILD_TYPE": "Release", "CMAKE_CXX_STANDARD": "20"},
)
return (project.test(), project.lint(), project.fmt())import { pipeline, type PipelineDefinition } from "@harmont/hm";
import { cmake } from "@harmont/hm/toolchains";
const project = cmake({
path: ".",
compiler: "clang-18",
defines: { CMAKE_BUILD_TYPE: "Release", CMAKE_CXX_STANDARD: "20" },
});
const pipelines: PipelineDefinition[] = [
{ slug: "ci", pipeline: pipeline([project.test(), project.lint(), project.fmt()]) },
];
export default pipelines;Every toolchain
Harmont ships toolchains for Rust, Python, Go, JavaScript/TypeScript
(js/ts, with npm, pnpm, yarn, and Bun), CMake (C/C++), Elixir,
and Zig. Each one's full method list lives in the
toolchains reference.