Set up a repository
The .land/tests file
Every column, placeholder and setting of the file that lists your test commands.
.land/tests lists the commands that test your repository. Commit it next to .land/setup.sh and run land add, and land reads it from then on. Each line is one test command, and land skips any unit whose reads didn't change.
An example
# .land/tests # name folder files command unit . tests/test_*.py pytest -q {file} lint . - ruff check . build . - npm run build ;; keep web web src/**/*.test.ts npx vitest run {file} ;; after=build e2e . - ./scripts/e2e.sh ;; network secrets=TOKEN
A change to .land/tests takes effect when you run land add again, so a branch can't change which tests guard main.
The four columns
- name
- A short name for the line. It shows up in verdicts and in land logs.
- folder
- Where the command runs, relative to the repository root. Use . for the root.
- files
- A pattern such as
tests/test_*.pymakes one unit per matching file, or-runs the command once, whole. - command
- The rest of the line, run by the shell. At most 400 characters: put anything longer in a script.
One unit per file or folder
With a files pattern, the command takes a placeholder, and land makes one unit for each match. More units means less to rerun, and they all run in parallel.
- {file}
- One unit per matching file, with that file's path.
- {files}
- One unit per folder, with every matching file in it.
- {dir}
- One unit per folder, with the folder's path (handy for go test ./{dir}).
Settings after ;;
End a line with ;; and any of these, separated by spaces. See Databases, network and secrets and Making checks fast for when to use them.
- keep
- A build step. What it writes is kept for the lines that run after it.
- after=NAME
- Runs after the build step NAME, on what it wrote.
- network
- The line can reach the internet. It runs on every merge and is never skipped.
- secrets=A,B
- Those secrets are in the line's environment (and network is on). Set them with land secret set.
- cpu=N, mem=G
- What each unit reserves: CPUs, and memory in GiB (each at most 64).