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

Installation

Build the Parity CLI from source, verify it, update it, and the environment variables it reads.

Parity is pre-release (v0.1.0). There are no published binaries or packages yet — no Homebrew formula, no npm package, no install script. Today the CLI is installed by building it from source. Prebuilt binaries for Linux and macOS are planned.

#Build from source

You need a Rust toolchain (stable) and Git.

bash
git clone https://github.com/x1991labs/parity && cd parity
cargo install --path crates/parity-cli

cargo install compiles a release build and copies the parity binary to ~/.cargo/bin. If your shell cannot find it, add that directory to your PATH:

bash
export PATH="$HOME/.cargo/bin:$PATH"

To try the CLI without installing it, build a debug binary and run it from the checkout:

bash
cargo build
./target/debug/parity --help

#Verify

bash
parity --version
parity 0.1.0

parity --help lists the commands:

CommandWhat it does
parity initCreates parity.yaml and an example workflow in tests/parity/. Never prompts.
parity validateChecks the configuration and scenario sources without sending requests.
parity compareCompares the baseline and candidate environments.
parity reportRenders an existing report as terminal output, Markdown, JUnit, HTML or JSON.
parity uploadSends a report to a hosted workspace. Optional.

Every command accepts --color auto|always|never, --no-color and -q, --quiet.

#Start a project

In the repository of the API you want to test:

bash
parity init
  + ./parity.yaml
  + ./tests/parity/example.yaml

  No OpenAPI document found; add one under `sources` to generate scenarios.

  Next:
    1. Start both versions of your API (http://localhost:8080 and http://localhost:8081).
    2. parity validate   check the configuration
    3. parity compare    compare their behaviour

init looks for an OpenAPI document in the usual places (openapi.yaml, openapi.json, api/openapi.yaml, docs/openapi.yaml, spec/openapi.yaml, swagger.yaml and a few more) and adds it as a source when it finds one. It refuses to overwrite an existing parity.yaml unless you pass --force.

FlagDefaultMeaning
--baseline <URL>http://localhost:8080Baseline URL written to the configuration
--candidate <URL>http://localhost:8081Candidate URL written to the configuration
--openapi <FILE>auto-detectedOpenAPI document to generate scenarios from
--dir <DIR>.Directory to initialise
--forceoffOverwrite existing files

#Update

Pull the repository and install again; cargo install replaces the existing binary.

bash
git pull
cargo install --path crates/parity-cli

Reports record the version of the tool that produced them in run.tool.version.

#Uninstall

bash
cargo uninstall parity-cli

Parity keeps no global state. The only files it writes are the ones you ask for: by default .parity/report.json next to your configuration.

#Environment variables

Flags take precedence over environment variables, which take precedence over parity.yaml.

VariableEquivalent flagMeaning
PARITY_CONFIG--configPath to the configuration file (default parity.yaml in the working directory)
PARITY_BASELINE_URL--baselineBaseline environment URL
PARITY_CANDIDATE_URL--candidateCandidate environment URL
PARITY_BASELINE_REVISION--baseline-revisionRevision (commit SHA, tag) deployed as the baseline
PARITY_CANDIDATE_REVISION--candidate-revisionRevision deployed as the candidate
PARITY_PULL_REQUEST--pull-requestPull request number recorded in the report
PARITY_API_URL--api-urlHosted workspace URL for uploads (default https://parity.x1991labs.com)
PARITY_TOKEN—Project token for --upload and parity upload. Read from the environment only, never from a flag or the configuration
CI--ciAny truthy value switches compare to non-interactive output
NO_COLOR--no-colorDisables colour

Any other variable can be referenced from parity.yaml as ${NAME}; see Configuration.

In GitHub Actions the CLI also reads GITHUB_REPOSITORY, GITHUB_REF, GITHUB_HEAD_REF, GITHUB_SERVER_URL and GITHUB_RUN_ID to record where a run came from, and GITHUB_ACTIONS to decide whether to print annotations.

    Loading the index…