Set up a repository

Recipes

A setup.sh and a .land/tests to start from for each language and package manager, and how to add one.

A starting point for each language and package manager: a .land/setup.sh that installs what the tests need, and a .land/tests that splits them finely. When a repository has no .land/tests and no CI workflow, land add --dry-run --json offers the recipes that fit it as suggest, with the patterns already checked against its files. Commit both files, then run land add. Every format detail is in The .land/tests file.

Each recipe is one file in the land repository's recipes/ folder, and anyone can add one (below). Pin your own versions, and install only dependencies in setup, never your project itself.

go

Go from go.dev, modules downloaded once so tests run offline, one unit per package folder. Offered when the repository's root has go.mod.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq curl ca-certificates
curl -fsSL https://go.dev/dl/go1.27.4.linux-amd64.tar.gz | tar -xz -C /usr/local
ln -sf /usr/local/go/bin/go /usr/local/bin/
export HOME=/root GOMODCACHE=/opt/gomod GOTOOLCHAIN=local GOFLAGS=-modcacherw
go mod download && chmod -R a+rX /opt/gomod
# .land/tests
# name  folder  files  command
pkg     .       **/*_test.go  GOMODCACHE=/opt/gomod GOPROXY=off GOTOOLCHAIN=local go test ./{dir}
# .land/tests, when the one above matches no file
# name  folder  files  command
pkg     .       -  GOMODCACHE=/opt/gomod GOPROXY=off GOTOOLCHAIN=local go test ./...

java-gradle

JDK 21 from Debian, the test classpath downloaded once through the repository's Gradle wrapper, test classes built once and the tests run after them. Offered when the repository's root has build.gradle.kts|build.gradle.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq --no-install-recommends openjdk-21-jdk-headless
export GRADLE_USER_HOME=/opt/gradle
./gradlew --no-daemon dependencies --configuration testRuntimeClasspath >/dev/null
chmod -R a+rwX /opt/gradle
# .land/tests
# name  folder  files  command
build   .       -  GRADLE_USER_HOME=/opt/gradle ./gradlew --offline --no-daemon -q testClasses ;; keep
test    .       -  GRADLE_USER_HOME=/opt/gradle ./gradlew --offline --no-daemon test ;; after=build

java-maven

JDK 21 and Maven from Debian, dependencies downloaded once so tests run offline, test classes built once and the tests run after them. Offered when the repository's root has pom.xml.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq --no-install-recommends openjdk-21-jdk-headless
apt-get install -y -qq --no-install-recommends maven
mvn -B -q -Dmaven.repo.local=/opt/m2 dependency:go-offline
chmod -R a+rwX /opt/m2
# .land/tests
# name  folder  files  command
build   .       -  mvn -o -B -q -Dmaven.repo.local=/opt/m2 test-compile ;; keep
test    .       -  mvn -o -B -q -Dmaven.repo.local=/opt/m2 surefire:test ;; after=build

node-npm

Node 24 from nodejs.org, dependencies from package-lock.json with npm ci. One unit per Vitest or Jest file, or the package's own test script when it uses neither. Offered when the repository's root has package.json.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq curl ca-certificates xz-utils
curl -fsSL https://nodejs.org/dist/v24.11.1/node-v24.11.1-linux-x64.tar.xz | tar -xJ -C /usr/local --strip-components=1
npm ci --no-audit --no-fund
# .land/tests (vitest), if package.json has "vitest"
# name  folder  files  command
spec    .       **/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}  node_modules/.bin/vitest run {file}
# .land/tests (jest), if package.json has "jest"
# name  folder  files  command
spec    .       **/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}  node_modules/.bin/jest --coverage=false --verbose=false --runTestsByPath {file}
# .land/tests (test-script)
# name  folder  files  command
test    .       -  npm test

node-pnpm

Node 24 from nodejs.org, dependencies from pnpm-lock.yaml with pnpm. One unit per Vitest or Jest file, or the package's own test script when it uses neither. Offered when the repository's root has package.json, pnpm-lock.yaml.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq curl ca-certificates xz-utils
curl -fsSL https://nodejs.org/dist/v24.11.1/node-v24.11.1-linux-x64.tar.xz | tar -xJ -C /usr/local --strip-components=1
npm install -g pnpm
pnpm install --frozen-lockfile
# .land/tests (vitest), if package.json has "vitest"
# name  folder  files  command
spec    .       **/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}  node_modules/.bin/vitest run {file}
# .land/tests (jest), if package.json has "jest"
# name  folder  files  command
spec    .       **/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}  node_modules/.bin/jest --coverage=false --verbose=false --runTestsByPath {file}
# .land/tests (test-script)
# name  folder  files  command
test    .       -  pnpm test

node-yarn-berry

Node 24 from nodejs.org, dependencies from yarn.lock with Yarn 2 or newer (the repository has a .yarnrc.yml). One unit per Vitest or Jest file, or the package's own test script when it uses neither. Offered when the repository's root has package.json, yarn.lock, .yarnrc.yml.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq curl ca-certificates xz-utils
curl -fsSL https://nodejs.org/dist/v24.11.1/node-v24.11.1-linux-x64.tar.xz | tar -xJ -C /usr/local --strip-components=1
corepack enable
yarn install --immutable
# .land/tests (vitest), if package.json has "vitest"
# name  folder  files  command
spec    .       **/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}  node_modules/.bin/vitest run {file}
# .land/tests (jest), if package.json has "jest"
# name  folder  files  command
spec    .       **/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}  node_modules/.bin/jest --coverage=false --verbose=false --runTestsByPath {file}
# .land/tests (test-script)
# name  folder  files  command
test    .       -  yarn test

node-yarn

Node 24 from nodejs.org, dependencies from yarn.lock with Yarn 1. One unit per Vitest or Jest file, or the package's own test script when it uses neither. Offered when the repository's root has package.json, yarn.lock.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq curl ca-certificates xz-utils
curl -fsSL https://nodejs.org/dist/v24.11.1/node-v24.11.1-linux-x64.tar.xz | tar -xJ -C /usr/local --strip-components=1
npm install -g yarn
yarn install --frozen-lockfile
# .land/tests (vitest), if package.json has "vitest"
# name  folder  files  command
spec    .       **/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}  node_modules/.bin/vitest run {file}
# .land/tests (jest), if package.json has "jest"
# name  folder  files  command
spec    .       **/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}  node_modules/.bin/jest --coverage=false --verbose=false --runTestsByPath {file}
# .land/tests (test-script)
# name  folder  files  command
test    .       -  yarn test

python-pip

A venv with the first of requirements-dev.txt, requirements-test.txt or requirements.txt installed, one pytest unit per test file. Offered when the repository's root has requirements-dev.txt|requirements-test.txt|requirements.txt.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq curl ca-certificates
curl -LsSf https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL=/usr/local/bin sh
uv venv /opt/venv --python /usr/bin/python3
for r in requirements-dev.txt requirements-test.txt requirements.txt; do
  if [ -f "$r" ]; then uv pip install --python /opt/venv/bin/python -r "$r"; break; fi
done
# .land/tests (pytest)
# name  folder  files  command
tests   .       **/{test_*.py,*_test.py}  /opt/venv/bin/python -m pytest -q {file}
# .land/tests (pytest)
# name  folder  files  command
tests   .       -  /opt/venv/bin/python -m pytest -q

python-poetry

A venv with the dependencies poetry.lock pins, installed by Poetry from its own venv, one pytest unit per test file. Offered when the repository's root has pyproject.toml, poetry.lock.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq curl ca-certificates
curl -LsSf https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL=/usr/local/bin sh
uv venv /opt/venv --python /usr/bin/python3
uv venv /opt/poetry && uv pip install --python /opt/poetry/bin/python poetry
VIRTUAL_ENV=/opt/venv /opt/poetry/bin/poetry install --no-root
# .land/tests (pytest)
# name  folder  files  command
tests   .       **/{test_*.py,*_test.py}  /opt/venv/bin/python -m pytest -q {file}
# .land/tests (pytest)
# name  folder  files  command
tests   .       -  /opt/venv/bin/python -m pytest -q

python-pyproject

A venv with pyproject.toml's dependencies and every extra, one pytest unit per test file. For a project with no lock file. Offered when the repository's root has pyproject.toml.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq curl ca-certificates
curl -LsSf https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL=/usr/local/bin sh
uv venv /opt/venv --python /usr/bin/python3
uv pip install --python /opt/venv/bin/python -r pyproject.toml --all-extras
# .land/tests (pytest)
# name  folder  files  command
tests   .       **/{test_*.py,*_test.py}  /opt/venv/bin/python -m pytest -q {file}
# .land/tests (pytest)
# name  folder  files  command
tests   .       -  /opt/venv/bin/python -m pytest -q

python-uv

A venv with the dependencies uv.lock pins (every group), one pytest unit per test file. Offered when the repository's root has pyproject.toml, uv.lock.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq curl ca-certificates
curl -LsSf https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL=/usr/local/bin sh
uv venv /opt/venv --python /usr/bin/python3
uv export --frozen --all-groups --no-hashes --no-emit-project -o /tmp/land-requirements.txt
uv pip install --python /opt/venv/bin/python -r /tmp/land-requirements.txt
# .land/tests (pytest)
# name  folder  files  command
tests   .       **/{test_*.py,*_test.py}  /opt/venv/bin/python -m pytest -q {file}
# .land/tests (pytest)
# name  folder  files  command
tests   .       -  /opt/venv/bin/python -m pytest -q

ruby-bundler

Ruby from Debian, gems installed with Bundler once, one unit per RSpec or Minitest file. Offered when the repository's root has Gemfile.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq ruby ruby-dev build-essential
gem install --no-document bundler
bundle install --jobs 4
# .land/tests
# name  folder  files  command
spec    .       spec/**/*_spec.rb  bundle exec rspec {file}
# .land/tests, when the one above matches no file
# name  folder  files  command
test    .       test/**/{*_test.rb,test_*.rb}  bundle exec ruby -w -Itest {file}
# .land/tests, when the one above matches no file
# name  folder  files  command
spec    .       -  bundle exec rspec

rust-cargo

Rust from rustup with crates vendored so tests run offline. Every test binary is built once, then the library's tests and each integration test file run after it. Offered when the repository's root has Cargo.toml.

# .land/setup.sh
#!/bin/sh
set -e
apt-get update -qq && apt-get install -y -qq curl ca-certificates gcc libc6-dev
export HOME=/root RUSTUP_HOME=/opt/rustup CARGO_HOME=/opt/cargo
curl -fsSL https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain 1.100.0
ln -sfn /opt/rustup/toolchains/1.100.0-x86_64-unknown-linux-gnu /opt/rust
mkdir -p .cargo && /opt/rust/bin/cargo vendor vendor > .cargo/config.toml
chmod -R a+rX /opt/rustup vendor .cargo Cargo.lock
# .land/tests
# name  folder  files  command
build   .       -  PATH=/opt/rust/bin:$PATH cargo test --offline --no-run ;; keep
lib     .       -  PATH=/opt/rust/bin:$PATH cargo test --offline --lib ;; after=build
tests   .       tests/*.rs  PATH=/opt/rust/bin:$PATH cargo test --offline --test $(basename {file} .rs) ;; after=build
# .land/tests, when the one above matches no file
# name  folder  files  command
build   .       -  PATH=/opt/rust/bin:$PATH cargo test --offline --no-run ;; keep
lib     .       -  PATH=/opt/rust/bin:$PATH cargo test --offline --lib ;; after=build

Add a recipe

Open a pull request that adds one file, recipes/<name>.md, to the land repository. Nothing else changes: the client builds its catalog from that folder, so the next client release offers the recipe, and this page lists it. Before you send it, run the recipe on a real repository with land add until it is accepted, and name that repository in the pull request.

# <name>

A sentence or two on what it installs and how it splits the tests.

when: <file> <file>       every one is at the repository's root; a|b is either
group: <group>            one recipe of a group is offered: the one whose when names the most files

## setup.sh
(a fenced block: the whole .land/setup.sh)

## tests [<variant>] [if <file> has <text>]
(a fenced block: the whole .land/tests)

A recipe may have several ## tests sections. The first whose condition holds and whose every pattern matches a file of the repository is offered, named <name>-<variant>; so a last section with no pattern (- in the files column) is the fallback. Write it for the check: setup.sh runs as root with the network on and installs everything system-wide (/usr/local, /opt); the tests run offline, as an unprivileged user, with a fresh HOME.