Running in CI
A workspace needs nothing installed to run in a pipeline: one static binary, the files already in the repository, and an exit code. There is no plugin to add and no reporter to configure.
This is a whole GitHub Actions workflow. It downloads the tool, parses the files, runs the test plans, and keeps the report either way.
name: API tests
on: [push, pull_request]
jobs:
api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install stampdrill
run: curl -sL https://github.com/stampdrill/stampdrill/releases/latest/download/stampdrill-linux-x86_64.tar.gz | tar xz
- name: Test the API
run: |
mkdir -p reports
./stamp check api
./stamp test api --junit reports/junit.xml
- uses: actions/upload-artifact@v4
if: always()
with:
name: api-reports
path: reports/
curl … | tar xz | Leaves stamp in the working directory. The archive is one static binary, so there is no runtime, no package manager and nothing to cache. |
mkdir -p reports | Where the reports go. stamp test makes the folder itself; stamp load expects it to be there. |
./stamp check api | Parses every file and sends nothing. A typo fails the build in a second instead of after the slowest request. |
./stamp test api | Runs the test plans in that folder and writes the report. |
if: always() | Keeps the report when the step failed, which is the run you wanted it for. |
The log is the same output you get locally, without the colour and the banner, because the pipeline is not a terminal.
stamp check api
✓ 2 files, 2 requests
stamp test api --junit reports/junit.xml
▶ Smoke posts.stamp
✓ run 175 ms
✓ 1 iteration, 2 requests, 5 checks, 176 ms
wrote reports/junit.xml
✓ all 1 plan passed
What decides the build is the exit code.
| 0 | Everything passed. |
| 1 | A check did not hold, or a load test missed a threshold. |
| 2 | A file could not be read or parsed, no plan matched, or the arguments were wrong. |
The difference between 1 and 2 is the one worth keeping: 1 is the API misbehaving, 2 is the test suite itself being broken. Note that --tags smoke matching no plan at all is a 2, not an empty pass, so a renamed tag fails loudly rather than quietly testing nothing.
The rest, as you need it
Everything above is enough for a first pipeline. These are the four questions that come next.
Credentials. Nothing secret belongs in a committed file. getenv reads the runner's environment, and secret() keeps the value out of the log even when a request is printed in full.
# environment.stamp
vars env=prod {
token = secret(getenv("API_TOKEN"))
}
More than one environment. A dimension value given on the command line points the same files somewhere else, which is one job per value in a build matrix.
stamp test api -d env=staging
stamp test api env=staging # the same thing, shorter
A plan that already says matrix env = staging|prod covers both in a single run instead, and reports them as separate iterations.
Load tests as a gate. stamp load exits 1 when a threshold is missed, so a nightly job needs no extra logic to fail.
stamp load api --json reports/load.json --html reports/load.html
Other runners. The same commands work in GitLab CI, Jenkins or a plain container; only the artifact step above is GitHub's. Builds are published for Linux on x86_64 and arm64 and for macOS as a universal binary, and a macOS runner can take the Homebrew formula instead:
brew install stampdrill/tap/stampdrill
Useful anywhere: -q for failures only, --no-color and STAMPDRILL_NO_BANNER=1 for a runner that pretends to be a terminal, --tags to keep a pull request pipeline short, -v name=value to override one variable for a run.
Nothing on this page happens in the app, which is the point of it. A pipeline has no window: it runs the free command line tool against the files in the repository and answers with a log and an exit code. The app is where those plans get written and watched before they are pushed.
Next: Test plans for what stamp test runs, Reports for the other two formats, and Secrets for keeping credentials out of the repository.