Skip to content

Test files

A test file declares one test: which pool runs it, when it starts, and the jobs with their steps. Reoclo reads each file from your repository and runs it on test servers.

Put one file per test in ci/reoclo/tests/:

ci/reoclo/tests/<name>.yml

The file name is the test’s name. A name starts with a lowercase letter or digit and uses lowercase letters, digits and dashes, up to 63 characters. Reoclo reads the file at the commit under test.

A test file is separate from the application files in ci/reoclo/. A test often covers a whole system, has its own triggers and can run for hours, so it never holds an application’s deploy.

Never put a secret value in a test file. Anyone with read access to your repository can read it. Set secrets as variables on the test pool instead.

ci/reoclo/tests/load.yml
version: 1
pool: loadtest
on:
push:
branches: [main, "release/*"]
pull_request:
branches: [main]
manual: true
cancel_superseded: true
env:
LOG_LEVEL: info
jobs:
smoke:
image: node:22
paths: ["src/**", "package.json", "package-lock.json"]
steps:
- run: npm ci
- name: Unit tests
run: npm test -- --runInBand
load:
needs: [smoke]
image: grafana/k6:latest
timeout_minutes: 720
env:
BASE_URL: https://staging.example.com
steps:
- name: Run the load test
run: k6 run load/checkout.js
KeyTypeDefaultNotes
version11The file format version.
poolstringrequiredThe slug of the test pool that runs the jobs. A job can override it with jobs.<id>.pool.
on.push.brancheslist of branch names or globsnot setA push to a matching branch starts a run. Globs use *, as in release/*.
on.pull_request.brancheslist of branch names or globsnot setA pull request whose target branch matches starts a run when it is opened, gets new commits or is reopened. See Pull requests.
on.manualboolean or mappingtrueAllows runs started from the dashboard, the CLI and the API. A mapping with inputs also declares the values a manual run takes. See Manual run inputs.
on.manual.inputs.<name>.descriptionstring, up to 300 charactersemptyHelp text shown next to the field when you start a run.
on.manual.inputs.<name>.requiredbooleanfalseA manual run must give the input a value, unless it has a default.
on.manual.inputs.<name>.defaultstring, up to 2,048 charactersnot setThe value a run uses when none is given. Push and pull request runs always use it.
on.manual.inputs.<name>.secretbooleanfalseHides the value everywhere and masks it in job output.
cancel_supersededbooleantrueA newer run of the same test on the same branch or pull request cancels the older unfinished runs. See Cancelling superseded runs.
pathslist of globsemptyJobs without their own paths run only when a changed file matches. See Path filters.
envmap of stringsemptyPlain values for every job. Secrets come from the pool’s variables.
checkout.submodulesbooleanfalseRuns git submodule update --init --recursive after the checkout, for every job. See Submodules.
jobs.<id>.imageimage referencerequiredThe container image the steps run in. The repository is mounted at the working directory. It can be a private image when the pool has a registry credential for its registry. See Private images.
jobs.<id>.poolstringthe file’s poolRuns this job on a different pool.
jobs.<id>.needslist of job IDsemptyJobs that must pass before this one starts. Reoclo rejects a cycle.
jobs.<id>.pathslist of globsthe file’s pathsThis job runs only when a changed file matches. Replaces the file’s paths for this job.
jobs.<id>.stepslistrequiredThe commands to run, in order.
jobs.<id>.steps[].runshell commandrequiredRuns with sh -e, so a failing command stops the step.
jobs.<id>.steps[].namestringthe commandThe label shown on the run page.
jobs.<id>.steps[].whenalways, success or failuresuccessWhether the step runs after an earlier step failed. See Steps after a failure.
jobs.<id>.timeout_minutesinteger, 1 to 7,20060The pool’s job time limit caps this value.
jobs.<id>.envmap of stringsemptyMerged over the file’s env for this job.
jobs.<id>.dockerbooleanfalseGives the job the Docker of its machine. See Docker in a job.
jobs.<id>.cache.keystring, 1 to 200 charactersrequired with cacheNames the cache. See Cache.
jobs.<id>.cache.key_fileslist of paths, up to 10emptyRepository files, such as lockfiles, whose content is part of the cache’s identity.
jobs.<id>.cache.pathslist of paths, 1 to 20required with cacheFiles and folders in the checkout to restore before the first step and save after the last.
jobs.<id>.artifacts.pathslist of paths, 1 to 20required with artifactsFiles and folders in the checkout to upload after the steps. See Artifacts.
jobs.<id>.artifacts.whenalways, success or failurealwaysWhich results upload the artifacts.

on.push.branches decides which pushes start a run. Reoclo reads this key from the copy of the file on your repository’s default branch. A pushed branch cannot add itself to the list by editing its own copy of the file.

on.pull_request.branches decides which pull requests start a run. It lists target branches, the branch a pull request merges into. A pull request opened, updated with new commits or reopened against a matching branch starts a run at the pull request’s head commit. See Pull requests for the rules.

on.manual controls runs started from the dashboard, the CLI and the API. A manual run uses the head of the branch you enter. To pass a value to a manual run, such as a link to the system under test, declare it as an input. See Manual run inputs.

Tests run only when an organization admin has enabled tests for the repository. See Enable tests on a repository.

ci/reoclo/tests/unit.yml
pool: ci
on:
pull_request:
branches: [main, "release/*"]
jobs:
unit:
image: node:22
steps:
- run: npm ci
- run: npm test

A run for a pull request follows these rules:

  • Tests must be enabled for the repository.
  • The default branch decides whether a test runs on pull requests and for which target branches. Adding on.pull_request in a pull request’s own copy of the file does nothing until that change is on the default branch.
  • The steps come from the pull request’s head commit, so a pull request can change what its own run does.
  • A pull request from a fork never starts a run. Only pull requests whose head branch is in the same repository run.
  • Reoclo posts the reoclo/test/<name> status on the head commit of the pull request.
  • If the branch also matches on.push.branches, a push to it starts a separate run for the push.

Pull request triggers work with GitHub repositories. Gitea repositories run tests on push and by hand.

When a new run starts, Reoclo cancels the older runs of the same test that have not finished:

  • A new push run cancels older unfinished runs for the same branch.
  • A new pull request run cancels older unfinished runs for the same pull request.

The cancelled run shows the reason Superseded by run #N, stops its jobs, deletes its machines and updates its commit status. Runs you start by hand are never cancelled this way, and they do not cancel other runs.

To keep every run, set cancel_superseded: false in the test file. Reoclo reads the setting from the file at the commit of the newer run.

When a pull request is merged or closed, Reoclo cancels the unfinished runs that the pull request started. The cancelled run shows the reason Pull request #N was merged or Pull request #N was closed, stops its jobs, deletes its machines and updates its commit status. This applies even when cancel_superseded is false. Push runs and runs you start by hand are not affected, and neither are runs that already finished.

ci/reoclo/tests/checks.yml
pool: ci
on:
pull_request:
branches: [main]
paths: ["src/**", "package.json"]
jobs:
unit:
image: node:22
steps:
- run: npm test
docs:
image: node:22
paths: ["docs/**", "*.md"]
steps:
- run: npm run docs:check

A paths list holds globs relative to the repository root. * matches within one directory, ** matches across directories and ? matches one character. A glob cannot start with / or contain ... A list holds up to 50 globs of up to 200 characters.

  • A job’s own paths replace the file’s paths for that job. A job with no paths of its own uses the file’s. A job with no paths at all always runs.
  • A job whose paths match none of the changed files is skipped. Its card on the run page says that no changed file matches its paths.
  • A job that needs a skipped job is skipped too.
  • A run passes when no job failed, so a run where every job was skipped passes.

The changed files come from your git provider: for a push, the files between the branch’s previous head and the new head, and for a pull request, the files the pull request changes. If Reoclo cannot get the list, every job runs. That happens when the provider does not answer, when a branch is new, and when the list may be cut short (300 or more files in a push, 1,000 or more in a pull request). Manual runs ignore path filters and run every job.

Inputs let a manual run take values you choose each time, such as a link to the system under test:

ci/reoclo/tests/room-load.yml
version: 1
pool: loadtest
on:
manual:
inputs:
room_link:
description: Link to the room to load
required: true
users:
description: Number of simulated users
default: 200
api_token:
description: Token for the room API
secret: true
jobs:
load:
image: grafana/k6:latest
steps:
- run: k6 run --vus "$INPUT_USERS" -e ROOM_LINK="$INPUT_ROOM_LINK" load/room.js

Steps read each input as an environment variable named INPUT_ followed by the input’s name in upper case, so room_link is INPUT_ROOM_LINK. An input wins over a file env key or a pool variable with the same name.

  • An input name starts with a lowercase letter and uses lowercase letters, digits and underscores, up to 40 characters. A file declares up to 20 inputs, and a value is up to 2,048 characters. Values are text, so default: 200 becomes the string 200.
  • When you start a manual run, Reoclo checks the values against the file at the commit being tested. A name the file does not declare, or a required input with no value and no default, is refused and the message names each one. A required input cannot be empty. An optional input with no value and no default is an empty string.
  • Push and pull request runs have nobody to type a value, so they use each input’s default. A file that also runs on push or pull requests is invalid when a required input has no default. Give the input a default or remove required.
  • You can supply values in the dashboard, where the Run dialog shows one field for each input of the file at the branch you enter, with reoclo tests run --input, and through the API.
  • A re-run of a manual run uses the same input values as the run it repeats.

Secret inputs are for values you would not paste into a ticket. Reoclo stores a secret value encrypted, never shows it on the run page or returns it from the API, and masks it in job output (values of 4 or more characters). The run page lists the secret inputs by name only. A non-secret input is shown with its value on the run page.

A default is part of the test file, so anyone who can read your repository can read it, even for a secret input. Use a default only for a harmless fallback. Never put a real secret in one.

By default a job’s container has no access to Docker. Set docker: true on a job to let its steps start containers, build images, run docker compose and use Testcontainers:

jobs:
integration:
image: node:22
docker: true
steps:
- run: npm run test:integration

With docker: true, Reoclo mounts the Docker socket of the job’s machine into the job’s container and sets these variables there:

VariableValue
DOCKER_HOSTThe mounted socket.
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDEThe same socket path, so the helper container Testcontainers starts to clean up after a run mounts the real socket.
TESTCONTAINERS_HOST_OVERRIDE127.0.0.1. The job shares the machine’s network, so a service you start, such as a database on a published port, is reached on 127.0.0.1.

When the pool has registry credentials, Reoclo also sets DOCKER_CONFIG to a read-only folder that holds those logins.

Reoclo sets these after your own variables, so a variable with the same name in the file or on the pool does not replace them.

Reach published ports at 127.0.0.1, not localhost. Docker on test machines publishes ports on IPv4 only, and inside a job localhost resolves to the IPv6 address ::1 first, so a client that tries only the first address, such as wget in Alpine images, is refused.

Things to know:

  • The job controls that machine’s Docker. It can start and stop every container on the machine, pull any image and mount the machine’s files into containers it starts. This is acceptable because each job runs on a machine created for it in your cloud account and deleted when the job ends, but only turn it on for code you trust. Containers and images the job leaves behind go away with the machine.
  • Bind mounts from the checkout work. Docker resolves the source of a bind mount on the machine, not inside your job’s container, so Reoclo mounts the checkout at its real path on the machine as well and runs your steps from there. Use relative paths or $PWD, such as ./init.sql:/docker-entrypoint-initdb.d/init.sql in a compose file or docker run -v "$PWD/conf:/conf". Do not use /workspace as a bind mount source: that path exists only inside the job’s container, so the daemon cannot find it and the service gets an empty directory.
  • Testcontainers talks to the socket directly, so the image does not need a Docker client. A step that runs docker or docker compose does: use an image that has them, such as docker:cli.
  • A docker: true job can pull private images for the containers it starts. See Private images.
  • Reoclo never runs a docker: true job without Docker. If the machine has no Docker socket the job errors before it starts, with a message that says so. A machine whose runner is older than 1.48.0 does not support the key and the job errors with a message that names the version.
  • docker must be true or false. A job without it does not get Docker.

The image of a job can be in a private registry. Credentials are not set in the test file, because anyone who can read the repository can read it. They are set on the test pool: pick the registry credentials the pool should use, and every job in the pool logs in to those registries before it pulls its image. See Private images for what a pool accepts and how the logins are handled.

jobs:
integration:
image: ghcr.io/acme/test-runner:1
docker: true
steps:
- run: docker compose -f compose.e2e.yml up -d

If the pool has a credential for ghcr.io, this job pulls its own image with it. Because the job sets docker: true, docker compose can pull private images from ghcr.io as well: Reoclo mounts the logins read-only in the container and points DOCKER_CONFIG at them. A job without docker: true uses the logins only for its own image pull.

A job that uses registry credentials needs a machine with runner 1.49.0 or later. A job on an older runner errors before it starts, with a message that names the version.

Set checkout.submodules to true when the repository has git submodules:

version: 1
pool: ci
checkout:
submodules: true
jobs:
build:
image: node:22
steps:
- run: npm ci

After the checkout, Reoclo runs git submodule update --init --recursive on each job’s machine with the same short-lived token it used to clone the repository. The token can read only the repositories your git provider connection can access, so give the connection access to every submodule’s repository.

Only submodules on the same host as your repository, over https, are supported. Use either a full https:// URL on that host or a relative path such as ../shared-lib.git. A submodule that uses SSH ([email protected]:acme/lib.git), plain http, or another host fails the job before any step runs, and the error names the submodule. Change its URL in .gitmodules to fix it.

Every job starts on a fresh machine, so by default it starts with no cache. Give a job a cache to keep files such as installed dependencies between runs:

ci/reoclo/tests/unit.yml
pool: ci
jobs:
unit:
image: node:22
cache:
key: pnpm
key_files: [pnpm-lock.yaml]
paths: [.pnpm-store]
steps:
- run: pnpm install --frozen-lockfile --store-dir .pnpm-store
- run: pnpm test

A cache lives in the storage bucket of the job’s pool, in your own cloud account. The pool needs a bucket before a job can use a cache: see Storage bucket. A run whose job asks for a cache on a pool without a bucket errors with a message that says so, and no job starts.

How a cache is found and kept:

  • Identity. A cache belongs to one test and one job. Its identity also holds the key string and the content of every file in key_files at the commit under test. Change the key string, or change a lockfile, and the job looks for a different cache.
  • Restore. Before the first step, Reoclo restores the exact cache: the one with the same test, job, key string and key file contents. If there is none, it restores the most recent cache for the same test, job and key string. A changed lockfile then starts from a mostly warm cache instead of an empty one.
  • Save. After the last step, Reoclo saves the cache only when the exact cache did not exist and every step passed. A failed run never saves, and a run that restored its exact cache does not save it again.
  • Shared across branches. The same test and job on any branch or pull request uses the same caches. Do not cache secrets or files that differ between branches.
  • Retention. A sweep deletes caches older than the pool’s cache retention, 7 days by default.

key_files and paths are plain paths relative to the checkout root, such as pnpm-lock.yaml or node_modules. A leading ./ and a trailing / are ignored. A path cannot be absolute, contain .. or point into .git, and there are no wildcards. A path that does not exist after the steps is skipped. Only files below your paths are ever restored.

Because paths must be inside the checkout, point your package manager’s store into the checkout and add that folder to .gitignore:

ToolHow
pnpmpnpm install --store-dir .pnpm-store, or pnpm config set store-dir .pnpm-store
npmnpm ci --cache .npm-cache
Yarnyarn config set cacheFolder .yarn-cache
pipPIP_CACHE_DIR=.pip-cache
CargoCARGO_HOME=$PWD/.cargo-home
GoGOMODCACHE=$PWD/.gomodcache and GOCACHE=$PWD/.gocache

The job log shows each step as a setup line, with sizes and times, for example [setup] cache: restored 412 MB from the exact key in 6.2s. A cache that cannot be restored is a warning and the job runs without it. A cache that cannot be saved is also a warning, and it never fails the job. A cache archive above 2 GiB is not saved, and the log says so.

A job cannot keep files after it ends, so give it artifacts to upload the ones you need, such as a test report:

ci/reoclo/tests/e2e.yml
pool: ci
jobs:
e2e:
image: mcr.microsoft.com/playwright:v1.49.0-noble
artifacts:
paths: [playwright-report, test-results]
when: always
steps:
- run: npm ci
- run: npx playwright test

After the steps, Reoclo packs the paths that exist into one .tar.gz archive per job and uploads it to the pool’s storage bucket. Paths follow the same rules as cache paths. If none of them exist, nothing is uploaded and the log says so.

  • when: always uploads whether the job passed or failed. success uploads only when every step passed. failure uploads only when a step failed.
  • A job that was cancelled or timed out uploads nothing.
  • The run page lists each job’s artifact with its size and a download link. The link is generated when you click it and works for a minute. Anyone who can view the run can download its artifacts.
  • A sweep deletes artifacts older than the pool’s artifact retention, 30 days by default.
  • An archive above 1 GiB is not uploaded, and the log says so. A failed upload is a warning and never fails the job.
  • Like a cache, artifacts need a pool with a bucket.

Jobs with a cache or artifacts need a test machine whose runner is version 1.50.0 or later. If it is older, the job errors with a message that names the version, and nothing is sent to the machine.

A step runs only while every earlier step has passed. Give a step when to run it after a failure too. This job stops its containers even when the integration tests fail:

ci/reoclo/tests/integration.yml
pool: ci
jobs:
integration:
image: node:22
docker: true
steps:
- run: docker compose up -d
- run: npm run test:integration
- name: Stop containers
run: docker compose down
when: always

when: always runs the step whether or not an earlier step failed. when: failure runs it only after a step failed. The default, success, runs it only while every earlier step passed.

  • The job reports the first step that failed, with its exit code. A later step that fails does not replace it. When every other step passed and an always step fails, the job fails because of that step.
  • A step that does not run is shown as skipped.
  • A cancelled job or one that reaches its timeout stops at once. when applies only after a step fails.
  • if is not supported. A step that sets it makes the file invalid and the message points you to when.

A job with a when: always or when: failure step needs a test machine whose runner is version 1.56.0 or later. If it is older, the job errors with a message that names the version, and nothing is sent to the machine.

LimitValue
Jobs per file20
Steps per job50
File size64 KB
timeout_minutes1 to 7,200
Globs per paths list50, each up to 200 characters
Inputs per file20
Input nameup to 40 characters
Input value or defaultup to 2,048 characters
Paths per cache.paths or artifacts.paths20
Files in cache.key_files10
Cache archive2 GiB
Artifact archive1 GiB

A file is invalid when it is over a limit, has a cycle in needs, names an unknown pool, sets docker or checkout.submodules to anything but true or false, or uses matrix or target, which are not available yet. Reoclo shows the reason next to the file on the Tests page. A push that reaches an invalid file creates an Errored run with the same reason.

  • A job with no needs starts as soon as its pool has a machine. Jobs that do not depend on each other run in parallel.
  • A step runs in the job’s container. The step’s working directory is the repository root.
  • A job stops at its first failing step. The later steps are reported as skipped, except steps with when set to always or failure, which still run.
  • If a job fails or errors, the jobs that need it are skipped. A run passes only when no job failed, errored or was cancelled. Jobs skipped because of path filters do not count against it.
  • A job that runs longer than its timeout is stopped and reported as errored.

A job receives:

  • The test file’s env, merged with the job’s own env.
  • The variables set on the test pool.
  • The run’s inputs, each as INPUT_<NAME>.
  • The variables Reoclo sets for every run: REOCLO_RUN_ID, REOCLO_COMMIT, REOCLO_REF and REOCLO_JOB.
  • For a pull request run only: REOCLO_BASE_REF, the branch the pull request merges into, and REOCLO_BASE_SHA, the commit that branch pointed at when the run started. Runs started by a push or by hand do not get them.

The job runs without git credentials, so git fetch against your repository fails inside it. For a pull request run, the checkout already holds the base commit and the history behind it, so git diff --name-only "$REOCLO_BASE_SHA"...HEAD lists the files the pull request changes and git merge-base "$REOCLO_BASE_SHA" HEAD finds the common ancestor. See Run only the specs a pull request changes. If Reoclo cannot fetch the base commit, the job log shows a warning on its first lines and the job still runs.

Give a variable a different name in each place, so it is clear which value a job sees. If a pool variable and the file’s env use the same name, the pool variable wins, and an input wins over both. Secret values from the pool and secret inputs are masked in job output.