Guides

Run Outqube from CI

Run a suite from GitHub Actions, GitLab CI or cron, wait for the result and fail the job when a test fails.

The CLI is the shortest way to run Outqube from CI. With --wait it starts a run, waits for it, prints the failure reports and sets the exit code. It reads the commit, branch and pull request from GitHub Actions, GitLab CI and Azure Pipelines, so the run shows up with the right labels.

You need an API key with the trigger scope stored as the secret OUTQUBE_API_KEY. See Authentication.

GitHub Actions: nightly suite

This workflow runs the nightly suite every night at 02:00 UTC and on demand, writes a JUnit report and keeps it as an artifact.

.github/workflows/outqube-nightly.yml
name: Outqube nightly
on:
  schedule:
    - cron: "0 2 * * *"
  workflow_dispatch:

jobs:
  outqube:
    runs-on: ubuntu-latest
    steps:
      - name: Run the nightly suite
        run: npx outqube run --suite nightly --url ${{ vars.STAGING_URL }} --wait --timeout 45m --cancel-on-timeout --junit out.xml
        env:
          OUTQUBE_API_KEY: ${{ secrets.OUTQUBE_API_KEY }}
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: outqube-junit
          path: out.xml

The job fails when the exit code is not 0:

CodeMeaning
0Passed.
1A test failed.
2The run errored, was cancelled, or the API is down. Also an outcome this CLI does not know.
3Usage or auth error: bad arguments, a missing or refused key, an unknown run.
4Timed out waiting.
130, 143Stopped by SIGINT or SIGTERM. The run was cancelled.

To fail only on failed tests and ignore run errors, pass --fail-on failed. The default, any, also fails on errors.

Pull requests from forks

Pull requests from forks get no secrets in GitHub Actions, so the key is empty and the CLI exits 3. Run Outqube on the branch in your own repository, or use the GitHub App.

GitLab CI

.gitlab-ci.yml
outqube:
  image: node:22
  script: npx outqube run --suite smoke --url "$STAGING_URL" --wait --junit out.xml
  artifacts:
    when: always
    reports:
      junit: out.xml

OUTQUBE_API_KEY is a masked CI/CD variable. Add a merge_request_event rule to run in merge request pipelines.

Any scheduler

0 2 * * * OUTQUBE_API_KEY=<your-key> npx outqube run --tag nightly --wait --fail-on failed --cancel-on-timeout --json > /var/log/outqube.json

For a schedule that Outqube runs itself, use the app's schedules instead.

Read the output in a script

With --json, run --wait prints { run, failures: [{ test_run_id, name, outcome, summary, report_markdown }] }. An error is one line on stderr: {"error":{"message","exit_code","code","request_id"}}. Treat an outcome you do not know as not passed.

Without the CLI

Call the API yourself: start the run with POST /runs, poll GET /runs/{runId} until status is completed or cancelled, then fail your job unless outcome is passed. The Quickstart has the code. Send an Idempotency-Key that names the commit and job, so a retried job does not start a second run.

Next steps

On this page