CLI for any CI
@maxoperf/cli does what the GitHub Action does, from any shell. maxoperf push mirrors the test files in your repository to MaxoPerf. maxoperf run does the same, starts each test, waits and exits non-zero when a run fails. It needs Node 20 or later.
npx @maxoperf/cli pushnpx @maxoperf/cli run --config TARGET_URL=https://staging.example.comConfigure
Section titled “Configure”| Variable | Required | Meaning |
|---|---|---|
MAXOPERF_API_KEY | yes | API key. Keep it in your CI secret store. |
MAXOPERF_ACCOUNT_ID | yes | Account id, shown on Settings → API keys. |
MAXOPERF_PROJECT_ID | no | Default project. --project and the file’s projectId take precedence. |
MAXOPERF_API_BASE | no | API origin. Defaults to https://app.maxoperf.com. |
Commands
Section titled “Commands”maxoperf push [--tests <glob>]... [--project prj-...] [--root .] [--json] [--api-base URL]maxoperf run [push flags] [--config KEY=VALUE]... [--no-wait] [--fail-on criteria|never] [--timeout 60]--testsdefaults to.maxoperf/tests/*.{yml,yaml}. Point it at one file to sync or run one test.--config KEY=VALUEoverrides a config value for this run only.- Runs execute one after another.
--timeoutis in minutes.--jsonprints one JSON document on stdout and sends progress to stderr.
The file format and sync rules are in Keep tests in git. The CLI never prints the API key or the presigned upload URLs.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | Success. With run, every run passed. |
| 1 | A run failed or was cancelled (with --fail-on criteria). |
| 2 | Usage, test file or validation error. |
| 3 | API or network error, a run was blocked from starting, or a timeout. |
Most CI systems fail the job on any non-zero code. To treat exit 1 differently from 2 and 3, check $? yourself.
Provider detection
Section titled “Provider detection”The CLI detects GitHub Actions, GitLab CI, Jenkins, CircleCI and Bitbucket Pipelines from their standard environment variables. It attaches the provider, repository, commit, branch, pull request and pipeline URL to each run. The run’s CI chip in the console shows them.
GitLab CI
Section titled “GitLab CI”Add MAXOPERF_API_KEY and MAXOPERF_ACCOUNT_ID under Settings → CI/CD → Variables (mask and protect the key).
perf: image: node:22 stage: test variables: MAXOPERF_PROJECT_ID: prj-0123456789 script: - npx @maxoperf/cli run --config TARGET_URL=$STAGING_URL rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event"Jenkins
Section titled “Jenkins”Store the key as a secret text credential and bind it for the step:
pipeline { agent { docker { image 'node:22' } } environment { MAXOPERF_ACCOUNT_ID = 'acc-0123456789' } stages { stage('Load test') { steps { withCredentials([string(credentialsId: 'maxoperf-api-key', variable: 'MAXOPERF_API_KEY')]) { sh 'npx @maxoperf/cli run --config TARGET_URL=https://staging.example.com' } } } }}CircleCI
Section titled “CircleCI”Add the variables in Project settings → Environment variables.
version: 2.1jobs: perf: docker: - image: cimg/node:22.11 steps: - checkout - run: npx @maxoperf/cli run --config TARGET_URL=https://staging.example.comworkflows: perf: jobs: [perf]Bitbucket Pipelines
Section titled “Bitbucket Pipelines”Add the variables under Repository settings → Pipelines → Repository variables and mark the key as secured.
pipelines: pull-requests: '**': - step: name: Load test image: node:22 script: - npx @maxoperf/cli run --config TARGET_URL=https://staging.example.comRun from a laptop
Section titled “Run from a laptop”export MAXOPERF_API_KEY=mpak_...export MAXOPERF_ACCOUNT_ID=acc-0123456789npx @maxoperf/cli run --tests .maxoperf/tests/checkout.ymlOutside a CI system the CLI attaches no CI context, so these runs show no CI chip.