> ## Documentation Index
> Fetch the complete documentation index at: https://docs.harmonic.fun/llms.txt
> Use this file to discover all available pages before exploring further.

# Verify in CI

> Check the properties in aristotle.toml in your CI pipeline: what aristotle ci checks, setting up the manifest, and the GitHub Action.

`aristotle ci` checks the properties listed in your repository's `aristotle.toml`, and reports each one as a test in your CI system: a proved property passes, and a refuted one fails. It comes with the [CLI](https://docs.harmonic.fun/installation.md#use-the-cli), and detects GitHub Actions, GitLab CI, Jenkins, Buildkite, CircleCI, and Azure Pipelines on its own.

## What CI checks

CI checks the properties in `aristotle.toml`, a manifest you commit at the root of your repository, or of the subproject that the GitHub Action's `working-directory` input, or `--directory` on the command line, names. Each property has an id, and is stated in plain language or names something in your repository for Aristotle to check. The CI guide's [manifest section](https://github.com/harmonic-ai/aristotle/blob/main/docs/aristotle-in-ci.md#the-manifest) lists every kind.

Each run checks every property in the manifest against the commit being built, without reusing an earlier run's results. It reports each property as a test named by its id, in a JUnit report. On GitHub, the job page also gets a summary of every property, and failures and properties without a verdict show as annotations on the pull request.

A proof covers the property as stated, under its `assumptions` entry, if any, and the assumptions listed in the run's summary. Each run is a project in the web app, in the account whose key started it. The project shows that summary, and the log links to the project.

By default, a property left without a verdict doesn't fail the build on its own. Setting the GitHub Action's `fail-on` input to `no-verdict`, or passing `--fail-on no-verdict` on the command line, makes it fail. A property marked `expect = "refuted"`, a deliberate counterexample, passes when it's refuted and fails when it's proved. Properties that Aristotle proposes on its own are listed separately as suggestions, and never change the result. To check one on every run, add it to the manifest.

Aristotle verifies C, Rust, and Verilog. It doesn't verify Lean you write, but a Lean statement Aristotle published, committed unchanged, can be checked in CI as a `lean` property, which needs CLI 3.5.0 or later.

## 1. Write the manifest

At a terminal in your repository, run:

```shell wrap theme={null}
aristotle ci setup
```

It starts a run in which Aristotle reads the code, asks you about anything it can't settle, and proposes properties. The command writes them to `aristotle.toml`. Review and edit the file, check it with `aristotle ci --dry-run`, which starts no run, then commit it.

For a Verilog design, `aristotle ci` takes the build options and black boxes from the `aristotle.f` committed at the root of the repository or subproject, but `aristotle ci setup` doesn't read it. Setup uploads a black box's file with the rest of the checkout, so before you run it, match a model you mustn't send with a `.gitignore` rule. See [Checking properties in CI](https://docs.harmonic.fun/hardware/verilog.md#checking-properties-in-ci).

To start from a finished project instead, such as one you worked on in the web app, run `aristotle ci setup --from <project>`. It writes that project's properties without a new run. From a project that `aristotle ci` created, it copies the manifest that project checked, as it was committed, when the project's files hold it.

Either way, a property the command writes from Aristotle's description becomes a `lean` property when Aristotle published its statement in Lean. For each `lean` property whose file Aristotle published, the command saves that file along with any files from the same folder that it imports. If Aristotle reports that such a statement doesn't build, or its file imports a file from the same folder that the project doesn't have, the command writes the property as another kind instead, with a comment explaining why. Its `git add` line lists the saved files: stage them before the dry run, and commit them unchanged.

Review a change to those files in the pull request as you would a change to the manifest. If someone edits one, a run gets it as Lean you wrote, and nothing yet stops it from passing. Aristotle also can't yet stop a run from changing those files without publishing the change, which then goes unseen. The CI guide's [Lean statements](https://github.com/harmonic-ai/aristotle/blob/main/docs/aristotle-in-ci.md#lean-statements) section covers what fails a `lean` property, as `not the committed statement` or `statement doesn't build`, the exit codes, and the hourly budget of read-only Lean files.

You can also write the manifest by hand. Each property is a `[requested_properties.<id>]` table:

```toml wrap theme={null}
[requested_properties.fifo_no_overflow]
kind = "natural_language"
property = "The FIFO never accepts a write while it is full."

[requested_properties.ringbuf_pop_no_panic]
kind = "natural_language"
property = "RingBuffer::pop in src/lib.rs never panics."

[requested_properties.arbiter_one_grant]
kind = "sva"
identifier = "arbiter.a_one_grant"

[requested_properties.fifo_push_no_ub]
kind = "c_function_no_ub"
identifier = "fifo_push"

[requested_properties.fifo_no_underflow]
kind = "lean"
file = "Spec/Property.lean"
identifier = "Fifo.fifo_no_underflow"
```

A property can also take an `assumptions` entry, which states in plain language what it's checked under. The log, the JUnit report, and the job summary show it with the verdict. A `lean` property takes no `assumptions` entry: its statement states its own.

## 2. Add it to your pipeline

A CI job has nobody to approve a login, so create a key in [API keys](https://aristotle.harmonic.fun/keys) and store it as a secret named `ARISTOTLE_API_KEY`. In GitHub Actions, add the Aristotle action after the checkout, as in this workflow:

```yaml wrap theme={null}
on:
  pull_request:
    paths: # every run proves every property, so run only when they could change
      - "rtl/**"
      - "Spec/**"
      - "aristotle.toml"

concurrency: # a new push cancels the job, and its run, for the commit before it
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: harmonic-ai/aristotle@v3
        with:
          api-key: ${{ secrets.ARISTOTLE_API_KEY }}
```

Each run checks every property again, so its time and cost follow the size of the manifest, not the size of the change. Under `paths`, list the folders your properties depend on, the Lean files saved for your `lean` properties, and `aristotle.toml` itself. If you make the job a required check, a pull request that touches none of those paths can't merge, since GitHub leaves a skipped workflow's check pending.

For a Rust crate, list `src/**`, `Cargo.toml`, and `Cargo.lock` where the example lists `rtl/**`, and add the folder of each local path dependency. CI uploads what git tracks in the folder it checks, less the files a `.gitignore` rule matches. So that folder must hold the crate's workspace and package manifests, its sources, its `Cargo.lock`, if it has one, and every local path dependency, all committed and outside `.gitignore`. The Rust guide's [Dependencies](https://docs.harmonic.fun/software/rust.md#dependencies) section lists what a crate needs.

On GitLab CI, Jenkins, or another CI system, run `aristotle ci` in the image `ghcr.io/harmonic-ai/aristotle:3`, with the key in `ARISTOTLE_API_KEY`, and publish its JUnit report, `aristotle-results.xml`. Give the job longer than the step's time budget plus the job's own setup. The budget is 60 minutes unless the manifest, `--timeout`, or `ARISTOTLE_TIMEOUT` sets another. GitLab CI and Azure Pipelines end a job after 60 minutes by default, and a job ended that way writes no report.

> [!NOTE]
>
> **Private deployments**
>
> Create the key on your deployment. Set `ARISTOTLE_WEB_URL` to the address of your deployment in the job's environment. Run the job on a runner that reaches the deployment, over Tailscale or its allowed network.

## More in the CI guide

The [CI guide](https://github.com/harmonic-ai/aristotle/blob/main/docs/aristotle-in-ci.md) has the manifest format and recipes for GitLab CI, Jenkins, and other CI systems. It also covers what fails the build, `aristotle review`, time and cost, and what gets uploaded.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.