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.
git clone https://github.com/x1991labs/parity && cd parity
cargo install --path crates/parity-clicargo 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:
export PATH="$HOME/.cargo/bin:$PATH"To try the CLI without installing it, build a debug binary and run it from the checkout:
cargo build
./target/debug/parity --help#Verify
parity --versionparity 0.1.0parity --help lists the commands:
| Command | What it does |
|---|---|
parity init | Creates parity.yaml and an example workflow in tests/parity/. Never prompts. |
parity validate | Checks the configuration and scenario sources without sending requests. |
parity compare | Compares the baseline and candidate environments. |
parity report | Renders an existing report as terminal output, Markdown, JUnit, HTML or JSON. |
parity upload | Sends 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:
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 behaviourinit 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.
| Flag | Default | Meaning |
|---|---|---|
--baseline <URL> | http://localhost:8080 | Baseline URL written to the configuration |
--candidate <URL> | http://localhost:8081 | Candidate URL written to the configuration |
--openapi <FILE> | auto-detected | OpenAPI document to generate scenarios from |
--dir <DIR> | . | Directory to initialise |
--force | off | Overwrite existing files |
#Update
Pull the repository and install again; cargo install replaces the existing binary.
git pull
cargo install --path crates/parity-cliReports record the version of the tool that produced them in run.tool.version.
#Uninstall
cargo uninstall parity-cliParity 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.
| Variable | Equivalent flag | Meaning |
|---|---|---|
PARITY_CONFIG | --config | Path to the configuration file (default parity.yaml in the working directory) |
PARITY_BASELINE_URL | --baseline | Baseline environment URL |
PARITY_CANDIDATE_URL | --candidate | Candidate environment URL |
PARITY_BASELINE_REVISION | --baseline-revision | Revision (commit SHA, tag) deployed as the baseline |
PARITY_CANDIDATE_REVISION | --candidate-revision | Revision deployed as the candidate |
PARITY_PULL_REQUEST | --pull-request | Pull request number recorded in the report |
PARITY_API_URL | --api-url | Hosted 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 | --ci | Any truthy value switches compare to non-interactive output |
NO_COLOR | --no-color | Disables 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.