Skip to main content
hitspec integrates with GitHub Actions through an official action and direct CLI usage. You can run API tests on every push, pull request, or schedule, and report results using JUnit XML.

Official GitHub Action

The fastest way to add hitspec to your pipeline:
.github/workflows/api-tests.yml

Action Inputs

The Action defaults output to junit (handy for CI test reporting), whereas the hitspec CLI defaults to console.

Action Outputs

Using the CLI Directly

If you prefer installing hitspec yourself (for example, to pin a specific version or use Homebrew caching), you can call the CLI directly:
.github/workflows/api-tests.yml

Exit Codes

hitspec uses specific exit codes that GitHub Actions interprets as pass or fail: Any non-zero exit code causes the GitHub Actions step to fail, which blocks the workflow (and any required status checks) from passing.

Environment Variables and Secrets

Use GitHub secrets to pass sensitive values like API tokens and credentials. hitspec supports all major CLI flags as environment variables with the HITSPEC_ prefix.

Using an .env File

If your tests rely on an environment file, generate it from secrets at runtime:

Supported Environment Variables

Metrics and Notification Variables

Caching

Cache the hitspec binary to speed up subsequent runs:
If you install hitspec via Go, you can cache the Go module cache instead:

Matrix Testing

Run the same tests across multiple environments or configurations using a GitHub Actions matrix:
.github/workflows/api-tests.yml

Matrix with Tags

You can also use a matrix to run different test suites:

Stress Testing in CI

Run load tests in your pipeline to catch performance regressions:
The threshold input defines pass/fail criteria. If any threshold is exceeded, the step fails with exit code 1.

Reporting with JUnit

Most CI reporting tools understand JUnit XML. To publish results in GitHub pull requests, combine hitspec with a JUnit reporter action:
This adds a test summary directly to the pull request checks tab. Grant the workflow or job token checks: write when publishing check runs.

Full Example Workflow

A complete workflow that runs smoke tests on every PR, full tests on main, and uploads results:
.github/workflows/api-tests.yml
Last modified on July 14, 2026