GitHub Actions
GitLab CI
General CI/CD Tips
Exit Codes
hitspec uses standard exit codes. See Exit Codes for the full list.0— all tests passed1— one or more tests failed2— parse error3— config error
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Set up hitspec in GitHub Actions, GitLab CI, and other CI/CD systems.
name: API Tests
on: [push, pull_request]
permissions:
contents: read
checks: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install hitspec
run: |
curl -fsSL https://hitspec.dev/install.sh | sh
echo "$HOME/.hitspec/bin" >> $GITHUB_PATH
- name: Run API tests
run: |
hitspec run tests/ \
--env staging \
--output junit \
--output-file results.xml \
--bail
env:
HITSPEC_ENV: staging
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ !cancelled() }}
with:
files: results.xml
comment_mode: off
- name: Notify on failure
if: failure()
run: |
hitspec run tests/ \
--notify slack \
--notify-on failure
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
api-tests:
stage: test
script:
- curl -fsSL https://hitspec.dev/install.sh | sh
- hitspec run tests/ --env staging --output junit --output-file results.xml
artifacts:
when: always
reports:
junit: results.xml
variables:
HITSPEC_ENV: staging
0 — all tests passed1 — one or more tests failed2 — parse error3 — config error| Flag | Why |
|---|---|
--output junit | Machine-readable results for CI reporting |
--output-file results.xml | Write to a file for artifact upload |
--bail | Fail fast on first error |
--no-color | Clean output in CI logs |
--env staging | Target the correct environment |
export HITSPEC_ENV=staging
export API_TOKEN=${{ secrets.API_TOKEN }}
export SLACK_WEBHOOK=${{ secrets.SLACK_WEBHOOK }}
hitspec run tests/ --parallel --concurrency 10 --env staging
--output json --output-file results.json to generate output compatible with hitspec diff for regression detection between builds.