Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
110480c
Added GH action script for kani.
Aug 26, 2022
9d907e0
Adjusted script: no input, clear path.
Aug 26, 2022
6511a28
Merge branch 'main' into 1312-gh-action
Aug 26, 2022
3d5b2af
Documented CI integration.
Aug 26, 2022
c06a2aa
Merge branch 'main' of github.com:model-checking/kani into 1312-gh-ac…
Aug 26, 2022
9850493
Merge branch 'main' into 1312-gh-action
Aug 26, 2022
c5a50dc
Forgot to commit ci docs.
Aug 26, 2022
3e624a8
Added user configuration doc lost in recovery.
Aug 26, 2022
dfb2f75
Removed repeated paragraph.
Aug 26, 2022
dfbfd57
Merge branch 'main' into 1312-gh-action
Aug 29, 2022
56f8033
Merge branch 'main' of github.com:model-checking/kani into 1312-gh-ac…
Aug 29, 2022
6a805ec
Added image version and release check for that image version.
Aug 29, 2022
585dfee
Merge branch 'main' into 1312-gh-action
Aug 31, 2022
cb8279c
fixed capitalization.
Sep 1, 2022
1fbbc70
fixed capitalization.
Sep 1, 2022
989bd9e
fixed capitalization.
Sep 1, 2022
7c27168
Merge branch 'main' into 1312-gh-action
Sep 1, 2022
ad37719
Adjusted wording.
Sep 1, 2022
66a6487
Added command input for action, and associated docs.
Sep 2, 2022
d8bf4b7
Added action and image check after docker image push.
Sep 2, 2022
adf0aad
Adjusted env varaibles.
Sep 2, 2022
ead48f0
Merge branch 'main' into 1312-gh-action
Sep 6, 2022
940c435
Changed wording in README.
Sep 6, 2022
cb8ec7a
Made string checks more precise.
Sep 6, 2022
4fd161d
Increment version.
Sep 6, 2022
4f44d24
Merge branch 'main' into 1312-gh-action
Sep 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
echo "Git tag ${{env.TAG_VERSION}} did not match crate version ${{env.CRATE_VERSION}}"
exit 1
fi
# Check the action script's tag.
if ! grep -F "image: docker://ghcr.io/model-checking/kani-ubuntu-20.04:${{ env.TAG_VERSION }}" action.yml; then
echo "Git tag ${{env.TAG_VERSION}} did not match version in action.yml"
exit 1;
fi

- name: Create release
id: create_release
Expand Down Expand Up @@ -138,3 +143,9 @@ jobs:
org.opencontainers.image.source=${{ github.repositoryUrl }}
org.opencontainers.image.version=${{ needs.Release.outputs.version }}
org.opencontainers.image.licenses=Apache-2.0 OR MIT

- name: Check action and image is updated.
uses: ${{ env.OWNER_LC }}/kani@${{ needs.Release.outputs.version }})
with:
command: |
[[ "$(cargo kani --version)" == 'cargo-kani ${{ needs.Release.outputs.version }}' ]]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ Kani verifies:
* The absence of panics (e.g., `unwrap()` on `None` values)
* The absence of some types of unexpected behavior (e.g., arithmetic overflows)

## GitHub Action

Use Kani in your CI with `model-checking/kani@VERSION`. See the
[GitHub Action section in the Kani
book](https://model-checking.github.io/kani/install-github-ci.html)
for details.

## Installation

To install the latest version of Kani, run:
Expand Down
25 changes: 25 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright Kani Contributors
# SPDX-License-Identifier: Apache-2.0 OR MIT

name: 'Kani Rust Verifier'
description: 'Run the Kani Rust Verifier on a Rust Crate'
author: 'Kani Contributors'

branding:
icon: 'cloud'
color: 'orange'

inputs:
command:
description: 'Command to run.'
required: false
default: 'cargo kani --workspace'

runs:
using: 'docker'
image: docker://ghcr.io/model-checking/kani-ubuntu-20.04:0.10.0
args:
- bash
- '-c'
- 'set -e; export HOME=/root USER=$(id -nu); source $HOME/.bashrc; ${{ inputs.command }}'

1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [Getting started](./getting-started.md)
- [Installation](./install-guide.md)
- [Building from source](./build-from-source.md)
- [GitHub CI Action](./install-github-ci.md)
Comment thread
YoshikiTakashima marked this conversation as resolved.
- [Using Kani](./usage.md)
- [Verification results](./verification-results.md)
- [Debugging verification failures](./debugging-verification-failures.md)
Expand Down
54 changes: 54 additions & 0 deletions docs/src/install-github-ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# GitHub Action

Kani offers a GitHub Action for running Kani in CI. As of now, only
Ubuntu 20.04 with `x86_64-unknown-linux-gnu` is supported for Kani in
CI.

## Using Kani in your GitHub workflow
Our GitHub Action is available in the GitHub Marketspace with the name
`model-checking/kani`

The following workflow snippet will checkout your repository and run
`cargo kani` on it whenever a push or pull request occurs. Replace
`VER.SION` with the version of Kani you want to run with.

```yaml
name: Kani CI
on:
pull_request:
push:
jobs:
run-kani:
runs-on: ubuntu-20.04
steps:
- name: 'Checkout your code.'
uses: actions/checkout@v2

- name: 'Run Kani on your code.'
uses: model-checking/kani@vVER.SION
```

This will run `cargo kani --workspace` on the code you checked
out. You can also provide a custom command for running Kani. For
example, the below code runs 2 commands in sequence where the first
command compiles the crate without running Kani, and the second runs
Kani on specified packages.

```
- name: 'Run Kani on your code.'
uses: model-checking/kani@vVER.SION
with:
command: |
cargo kani --only-codegen
cargo kani -p mypackage-a -p mypackage-b
```

## FAQ
- **Kani takes too long for my CI**: Try running Kani on a
[schedule](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule)
with desired frequency.
- **Kani Silently Crashes with no logs**: Few possible reasons:
- Kani ran out of RAM. GitHub offers up to 7GB of RAM, but Kani may
use more. Run locally to confirm.
- GitHub terminates jobs longer than 6 hours.
- Otherwise, consider filing an issue [here](https://github.com/model-checking/kani/issues).
4 changes: 3 additions & 1 deletion docs/src/install-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Kani offers an easy installation option on two platforms:
* `x86_64-unknown-linux-gnu` (Most Linux distributions)
* `x86_64-apple-darwin` (Intel Mac OS)

Other platforms are either not yet supported or require instead that you [build from source](build-from-source.md).
Other platforms are either not yet supported or require instead that
you [build from source](build-from-source.md). To use Kani in your
GitHub CI workflows, see [GitHub CI Action](./install-github-ci.md).
Comment thread
YoshikiTakashima marked this conversation as resolved.

## Dependencies

Expand Down