Other CI systems
Run Parity non-interactively in any pipeline — the flags for automation, machine-readable outputs, policies and the exit code table.
Parity is one binary with no runtime dependencies. Anything that can start two versions of your API and run a command can run it. This page covers the non-interactive interface; for GitHub there is a ready-made action.
#The shape of a job
- Build or pull both versions of the API.
- Start them on two ports (or deploy them to two disposable environments).
- Wait until both answer.
- Run
parity compare --ciand let its exit code decide the job. - Keep the reports as build artifacts.
parity compare --ci \
--baseline http://localhost:8080 \
--candidate http://localhost:8081 \
--baseline-revision "$BASE_SHA" \
--candidate-revision "$HEAD_SHA" \
--output reports/parity.json \
--html reports/parity.html \
--junit reports/parity.junit.xml \
--summary reports/parity.md#Non-interactive mode
--ci removes the progress line and anything else that assumes a terminal. It is switched on automatically when the CI environment variable is set to a truthy value, which most CI systems do. On GitHub Actions it additionally prints workflow annotations.
Colour follows --color auto|always|never; auto disables it when the output is not a terminal, and NO_COLOR is honoured.
Parity never prompts for input, in any mode.
#Flags for automation
| Flag | Effect |
|---|---|
--ci | Non-interactive output. |
-o, --output <FILE> | Where to write the JSON report (default .parity/report.json). Always written. |
--json | Also print the JSON report to stdout. Human-readable output moves to stderr, so stdout can be piped. |
--html <FILE> | Also write a self-contained HTML report. |
--junit <FILE> | Also write a JUnit XML report. |
--summary <FILE> | Also write a Markdown summary. The file is appended to, never truncated. |
--outputs <FILE> | Append key=value results to a file. |
--policy <NAME=ACTION> | Override a policy for this run. Repeatable. |
-q, --quiet | Only print the result. |
-v, --verbose | Print every difference and every scenario. |
--dry-run | Show what would run without sending any request. Exits 0. |
--filter, --tag | Run a subset of the scenarios. |
#--json
parity compare --ci --json > report.jsonThe document on stdout is the same parity.report/v1 report that is written to --output.
#--outputs
Writes the headline numbers in key=value form — the format GitHub Actions uses for $GITHUB_OUTPUT, and easy to source or parse anywhere else:
verdict=fail
exit_code=1
total=89
unchanged=74
changed=13
errors=0
inconclusive=2
skipped=0
run_id=run_f587d29d412d4a2e5e7de2d8
report=/tmp/parity-out/r2.json#--junit
Most CI systems can display JUnit XML. Each scenario is a test case; changed scenarios are failures, environment errors are errors, and inconclusive and skipped scenarios are reported as skipped with the reason.
<testsuites name="parity" tests="89" failures="14" errors="0" skipped="2" time="0.025">
<testsuite name="parity" tests="89" failures="14" errors="0" skipped="2" timestamp="2026-11-28T15:59:49Z">
<testcase name="GET /health · valid request" classname="openapi.yaml" time="0.008">
<skipped message="inconclusive: Every difference also appears between two runs of the baseline, so it cannot be attributed to the candidate. Add ignore rules for: $.uptime_ms."/>
</testcase>#Policies
A policy decides what each kind of result does to the verdict. Set them in parity.yaml or per run:
parity compare --ci --policy unexpected_changes=warn --policy inconclusive=fail| Policy | Counts | Default | Actions |
|---|---|---|---|
unexpected_changes | Scenarios with behavioural changes | fail | fail, warn, ignore |
environment_errors | Scenarios that could not be executed | fail | fail, warn, ignore |
inconclusive | Inconclusive scenarios | warn | fail, warn, ignore |
warn prints the count as a warning without failing; ignore says nothing.
#Exit codes
| Code | Meaning | When |
|---|---|---|
0 | No policy violation | Nothing that a policy set to fail counts was found, and at least one scenario was compared. |
1 | Behavioural changes | unexpected_changes is fail and at least one scenario changed. |
2 | Environment errors | environment_errors is fail, at least one scenario could not be executed, and no failing behavioural change was found. Nothing can be concluded about behaviour. |
3 | Invalid configuration or usage | The configuration, a scenario file or the command line is wrong; or a requested output file could not be written. No comparison result. |
4 | Inconclusive, or nothing was compared | inconclusive is fail and a scenario was inconclusive; or no scenario at all produced a comparison. |
130 | Cancelled | Interrupted with Ctrl-C, or execution.max_duration_s was reached. |
When more than one applies, the code names the most actionable problem: 1 before 2 before 4.
Two details are deliberate:
- A run that compared nothing does not pass. If every scenario was skipped, errored or was inconclusive — or there were no scenarios — the run exits
4even with the default policy. "0 changes" from a run that verified nothing must not look green. Onlyinconclusive=ignoreturns this into a warning. - Usage errors are
3, not2. A mistyped flag exits3, so it can never be read as an environment error.
parity report exits 0 after rendering. Pass --exit-code to make it exit with the code stored in the report, which is useful when rendering and gating are separate pipeline stages:
parity report reports/parity.json --exit-code#Cancellation and time limits
On the first interrupt signal Parity stops starting new work, lets teardown steps run, writes the report and exits 130. A second interrupt exits immediately.
To bound a run from the configuration:
execution:
max_duration_s: 600
timeout_ms: 10000#Examples
#GitLab CI
parity:
stage: test
script:
- ./scripts/start-baseline.sh &
- ./scripts/start-candidate.sh &
- ./scripts/wait-for-both.sh
- parity compare --ci --junit parity.junit.xml --html parity.html --output parity.json
artifacts:
when: always
paths: [parity.json, parity.html]
reports:
junit: parity.junit.xml#A plain shell script
set -u
parity compare --ci --output parity.json
code=$?
case "$code" in
0) echo "behaviour unchanged" ;;
1) echo "behaviour changed — review parity.json" ;;
2) echo "an environment was unreachable; retry the job" ;;
4) echo "inconclusive — check authentication and scenario setup" ;;
*) echo "parity could not run (exit $code)" ;;
esac
exit "$code"Treating 2 differently from 1 is the point of having both: an unreachable environment is a reason to retry the job, not to review a diff.
#Docker and service containers
Single-label host names such as api-baseline — docker-compose services, CI service containers — count as local addresses, as do localhost, private IP ranges and names ending in .local, .test, .internal or .localhost. Mutating scenarios run against them without allow_mutations. Anything else needs explicit authorisation; see the mutation guard.