Skip to main content
Tuner has a GitHub Action. Every other CI tool runs the Tuner CLI directly and passes or fails the build on its exit code. These tools get no pull request comment and no job summary. Before you start, you need:

Deploy first, then test

Deploy the change to a staging agent first, then run Tuner after the deploy job, because a simulation calls your agent as it is deployed at that moment. See Deploy first, then test.

Exit codes

Any non-zero exit code fails the build. See Exit codes for what each code means. Exit 3 means Tuner couldn’t finish the run. The GitHub Action passes the build on 3 with a warning, and you can do the same by accepting it in your command:
Drop || [ $? -eq 3 ] to fail the build on 3 as well.

Send the commit and branch

Pass --meta so each run shows which change it tested. See Add run metadata and See which commit a run tested. Use the variables your CI tool sets: A tool doesn’t set every variable in every pipeline. The examples add a --meta pair only when its variable has a value, with ${VARIABLE:+...}.

Examples

Each example deploys first and then runs the simulations. It passes the build on exit 3 and sends run metadata. Replace the deploy step and the agent ID with your own, and keep the job’s timeout above --timeout. The examples run the CLI with npx. To pin a version, add @x.y.z to the package name.
Add the key in your project under Settings > CI/CD > Variables > Add variable. Name it TUNER_API_KEY and set Visibility to Masked.
The allow_failure block passes the pipeline when the CLI exits 3.

Read the result

The job log shows each Scenario’s result, a summary line and a link to the run. See Read the results. To keep the result as a file, add --output json and save stdout. Store tuner-result.json as a job artifact in your CI tool. See Use the results in scripts.

Cancel and time out

Set --timeout below your job’s own timeout, as the examples do. When the timeout runs out, the CLI cancels the run and the agent is free for the next one. When someone cancels a job, the CLI cancels the run only if the CI tool sends it a stop signal. GitLab, CircleCI and Jenkins don’t document a stop signal for a canceled job, so don’t rely on it. If a run is left behind, see Cancel a run.
If your tool does send SIGINT or SIGTERM to the step’s shell, start the command with exec, as in exec npx @usetuner.ai/cli sim run --tag smoke. The shell then hands the signal to the CLI. GitHub Actions works this way.

Troubleshooting

The CLI found no TUNER_API_KEY or TUNER_AGENT_ID. Check the secret’s name and that the job can read it. Some tools hide secrets from pipelines on unprotected branches or from forks.
Another job is testing the same agent. Run one Tuner job at a time for each agent, or cancel the other run. See Cancel a run.
Your CI tool has a limit on a step that prints nothing. Raise it above --timeout. In CircleCI, that is no_output_timeout.

Limits

Next steps

GitHub Actions

A pass/fail check, a pull request comment and a job summary on GitHub.

CLI

Every command, the exit codes and the JSON output.