Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Use Kani with Nix #147

Merged
merged 7 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,16 @@ jobs:
name: Check Kani proofs
runs-on: ubuntu-latest
steps:
- uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v14
with:
name: coliasgroup
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/checkout@v4
- name: Check Kani proofs
run: make -C hacking/kani/docker check
run: make check-kani-proofs
deploy-docs:
name: Deploy docs
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ witness-fast-tests:
$(nix_build) -A witnessFastTests --no-out-link
$(try_restore_terminal)

.PHONY: check-kani-proofs
check-kani-proofs:
$(run_in_nix_shell) "cargo kani -p sel4-bitfield-ops"

.PHONY: everything-except-non-incremental
everything-except-non-incremental:
$(nix_build) -A everythingExceptNonIncremental --no-out-link
Expand Down
6 changes: 3 additions & 3 deletions crates/private/tests/root-task/verus/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ verify = true

[dependencies.builtin]
git = "https://github.com/coliasgroup/verus.git"
tag = "keep/fdac1c3c52e639bf3e835802f63b4352"
tag = "keep/c1d8b986315b1d7fcaa0bf63c2e0497f"

[dependencies.builtin_macros]
git = "https://github.com/coliasgroup/verus.git"
tag = "keep/fdac1c3c52e639bf3e835802f63b4352"
tag = "keep/c1d8b986315b1d7fcaa0bf63c2e0497f"

[dependencies.vstd]
git = "https://github.com/coliasgroup/verus.git"
tag = "keep/fdac1c3c52e639bf3e835802f63b4352"
tag = "keep/c1d8b986315b1d7fcaa0bf63c2e0497f"
default-features = false
2 changes: 1 addition & 1 deletion hacking/cargo-manifest-management/manifest-scope.nix
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,6 @@ in rec {

verusSource = {
git = "https://github.com/coliasgroup/verus.git";
tag = mkKeepRef "fdac1c3c52e639bf3e835802f63b43520379b1a1"; # branch dev
tag = mkKeepRef "c1d8b986315b1d7fcaa0bf63c2e0497fbebab231"; # branch dev
};
}
7 changes: 0 additions & 7 deletions hacking/kani/.gitignore

This file was deleted.

20 changes: 0 additions & 20 deletions hacking/kani/Makefile

This file was deleted.

48 changes: 0 additions & 48 deletions hacking/kani/docker/Dockerfile

This file was deleted.

59 changes: 0 additions & 59 deletions hacking/kani/docker/Makefile

This file was deleted.

31 changes: 18 additions & 13 deletions hacking/nix/rust-utils/vendor-lockfile.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,21 @@
, buildPackages
, fetchurl
, jq
, toTOMLFile
, defaultRustToolchain
}:

{ rustToolchain ? defaultRustToolchain
, lockfileContents ? null
, lockfileValue ? if lockfileContents == null then null else builtins.fromTOML lockfileContents
, lockfileContents ? if lockfile == null then null else builtins.readFile lockfile
, lockfile ? null
, fetchGitSubmodules ? false
, extraMkCrateTarballURLFns ? {}
} @ args:

assert lockfileContents != null || lockfile != null;
assert lockfileValue != null;

let
lockfileContents =
if lockfile != null
then builtins.readFile lockfile
else args.lockfileContents;

lockfileValue = builtins.fromTOML lockfileContents;

packages =
# TODO enforce?
# assert lockfileValue.version == 3;
Expand Down Expand Up @@ -213,8 +208,18 @@ let
printf '{"files": {}, "package": null}' > "$out/.cargo-checksum.json"
'';

in {
lockfile = if lockfile != null then lockfile else builtins.toFile "Cargo.lock" lockfileContents;
inherit lockfileValue;
in lib.fix (self: {
configFragment = vendoredSources;
}
inherit lockfileValue;
lockfile =
let
fname = "Cargo.lock";
in
if lockfile != null
then lockfile
else (
if lockfileContents != null
then builtins.toFile fname lockfileContents
else toTOMLFile fname lockfileValue
);
})
2 changes: 2 additions & 0 deletions hacking/nix/scope/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ superCallPackage ../rust-utils {} self //

capdl-tool = callBuildBuildPackage ./capdl-tool {};

kani = callBuildBuildPackage ./kani {};

verus = callBuildBuildPackage ./verus {};

dafny = callBuildBuildPackage ./dafny {};
Expand Down
33 changes: 33 additions & 0 deletions hacking/nix/scope/kani/cbmc-viewer.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright 2024, Colias Group, LLC
#
# SPDX-License-Identifier: BSD-2-Clause
#

{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, jinja2
, voluptuous
}:

buildPythonPackage rec {
pname = "cbmc-viewer";
version = "3.8";

format = "pyproject";

src = fetchFromGitHub {
owner = "model-checking";
repo = "cbmc-viewer";
rev = "viewer-3.8";
hash = "sha256-GIpinwjl/v6Dz5HyOsoPfM9fxG0poZ0HPsKLe9js9vM=";
};

propagatedBuildInputs = [
setuptools
jinja2
voluptuous
];
}
Loading
Loading