Pre-release. Parity is not publicly available yet: the CLI, the GitHub Action and the hosted workspace open at launch. The demo runs on example data.

Skip to content

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

  1. Build or pull both versions of the API.
  2. Start them on two ports (or deploy them to two disposable environments).
  3. Wait until both answer.
  4. Run parity compare --ci and let its exit code decide the job.
  5. Keep the reports as build artifacts.
bash
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

FlagEffect
--ciNon-interactive output.
-o, --output <FILE>Where to write the JSON report (default .parity/report.json). Always written.
--jsonAlso 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, --quietOnly print the result.
-v, --verbosePrint every difference and every scenario.
--dry-runShow what would run without sending any request. Exits 0.
--filter, --tagRun a subset of the scenarios.

#--json

bash
parity compare --ci --json > report.json

The 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.

xml
<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:

bash
parity compare --ci --policy unexpected_changes=warn --policy inconclusive=fail
PolicyCountsDefaultActions
unexpected_changesScenarios with behavioural changesfailfail, warn, ignore
environment_errorsScenarios that could not be executedfailfail, warn, ignore
inconclusiveInconclusive scenarioswarnfail, warn, ignore

warn prints the count as a warning without failing; ignore says nothing.

#Exit codes

CodeMeaningWhen
0No policy violationNothing that a policy set to fail counts was found, and at least one scenario was compared.
1Behavioural changesunexpected_changes is fail and at least one scenario changed.
2Environment errorsenvironment_errors is fail, at least one scenario could not be executed, and no failing behavioural change was found. Nothing can be concluded about behaviour.
3Invalid configuration or usageThe configuration, a scenario file or the command line is wrong; or a requested output file could not be written. No comparison result.
4Inconclusive, or nothing was comparedinconclusive is fail and a scenario was inconclusive; or no scenario at all produced a comparison.
130CancelledInterrupted 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 4 even with the default policy. "0 changes" from a run that verified nothing must not look green. Only inconclusive=ignore turns this into a warning.
  • Usage errors are 3, not 2. A mistyped flag exits 3, 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:

bash
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:

yaml
execution:
  max_duration_s: 600
  timeout_ms: 10000

#Examples

#GitLab CI

yaml
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

bash
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.

    Loading the index…