Skip to content

Running Outry in CI

The same .outry (and .http) files you click through in the app can run as API tests on every push. expect checks decide whether the job passes.

.github/workflows/api-tests.yml
name: API tests
on: [push, pull_request]
jobs:
api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Start the service under test here (docker compose, a binary, …)
- name: Install outry
run: |
curl -fsSL https://raw.githubusercontent.com/1rowvy/outry/master/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Check request files
run: outry check api --format github
- name: Run API tests
run: outry run api --env ci --no-keyring --fail-fast
env:
OUTRY_TOKEN: ${{ secrets.API_TOKEN }}
  • Pin a version for reproducible builds: OUTRY_VERSION=v0.2.0 before sh.
  • Secrets come from OUTRY_<NAME> variables — see Secrets.
  • --no-keyring skips the keychain lookup, which does not exist on runners anyway.
  • The update notice is disabled automatically when the CI variable is set.

--json prints one JSON object per request (JSON Lines) instead of the human-readable report:

Terminal window
outry run api --json > results.jsonl
{"file":"api/users/get.outry","name":"GetUser","passed":true,"outcome":{"kind":"request","request":{…},"response":{"status":200,…},"asserts":[…],"calls":[…],"saved":{}}}
{"file":"api/users/bad.outry","name":"GetUser","passed":false,"error":"undefined variable(s): id"}

A flow’s outcome has "kind":"flow" with checks, calls, saved and error.

outry check checks the whole project without sending requests — one fast lint step: syntax, names of called requests, their arguments, shapes and call cycles, every environment (requests whose only excludes it, variables that are not defined in it), formatting, and — if there is a go.mod above the project — routes in the Go code (as outry import go --check):

Terminal window
outry check # the project found from the current directory
outry check api --env ci # one environment, secrets from the keychain / OUTRY_*
outry check --format github # annotations on the PR diff
api/orders/create.outry:1:1: error: not formatted (`outry fmt`)
api/orders/create.outry:7:22: error: variable `api_key` is not defined in staging, prod
api/orders/create.outry:9:13: error: `Seed` is limited to dev and cannot be called in prod
main.go:42:1: error: route DELETE /orders/{id} has no request (`outry import go` creates api/orders/delete.outry)
12 files, 3 environments, 18 Go routes: 4 errors, 0 warnings

Details and flags: outry check.