Skip to content

Building

Minimal builds your code reproducibly inside a sandbox, using a harness to wire up the right tools and build commands for your language or build system.

Running a build

shell
$ minimal build

This is shorthand for minimal run build. The harness configured in your minimal.toml determines what happens. For example, a Rust harness runs cargo build --release, while a pnpm harness runs pnpm install && pnpm build.

How harnesses work

When you declare a harness, it provides:

  • Build packages: compilers, build tools, and other dependencies needed during compilation
  • Runtime packages: libraries needed wherever the built software runs
  • Build commands: the default commands executed by minimal build
  • Environment variables: compiler flags, paths, and other configuration
toml
[harness]
use = "go"

With just this configuration, minimal build will run go build with the Go compiler and all necessary toolchain packages available in the sandbox.

Adding extra dependencies

Most projects need additional dependencies beyond what the harness provides. Declare them in the [harness] section:

toml
[harness]
use = "rust"
build_packages = ["protobuf-compiler", "perl"]
runtime_packages = ["openssl"]

Or add them with the CLI:

shell
$ minimal add --build protobuf-compiler
$ minimal add --runtime openssl

Running tests

Similarly to minimal build, you can run your test suite with:

shell
$ minimal test

This is shorthand for minimal run test, and uses the test command defined by your harness.

Persisting build state

By default, each task invocation starts from a clean state. To cache build artifacts across runs (like node_modules or target/), set a state_key:

toml
[defaults]
state_key = "dev"

Tasks sharing the same state_key share cached state, so your builds don't start from scratch every time.