Skip to content
Latchkey

How to Run Artillery Load Tests in GitHub Actions

Artillery exits non-zero when an ensure condition fails, so SLO checks on latency or errors become a CI gate.

Write a scenario file with an ensure block, install Artillery, and run artillery run. A breached ensure threshold fails the command and the job.

Steps

  • Define config.phases and a scenarios flow.
  • Add a config.ensure block with latency and error thresholds.
  • Run artillery run scenario.yml; a failed ensure exits non-zero.

scenario.yml

scenario.yml
config:
  target: https://staging.example.com
  phases:
    - duration: 60
      arrivalRate: 10
  ensure:
    thresholds:
      - http.response_time.p95: 500
      - http.codes.500: 0
scenarios:
  - flow:
      - get:
          url: /api/health

Workflow

.github/workflows/ci.yml
jobs:
  artillery:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20 }
      - run: npm install -g artillery@latest
      - run: artillery run scenario.yml

Gotchas

  • Without an ensure block, the run reports metrics but never fails the build.
  • arrivalRate is new virtual users per second, not a fixed concurrent count.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →