Something went wrong. Try again.
forked from verus-lang/verus
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388name: ci
on: workflow_dispatch:
merge_group:
pull_request: types: [opened, synchronize, reopened]
# Cancel a workflow iff the branch for the pull request got updated## How:# - This creates a concurrency group for workflow runs;# - When the workflow runs, it cancels in-progress runs if the concurrency group is the same# - The group names are ci-refs/pull/<PR #>/merge (in the case of PRs) and# ci-refs/heads/gh-readonly-queue/main/pr-<N>-<sha> for merge queue executionsconcurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true
permissions: contents: write
jobs: # check if formatting is correct fmt: runs-on: ubuntu-24.04 steps: - name: checkout uses: actions/checkout@v6
- name: setup rust uses: dtolnay/rust-toolchain@master with: toolchain: 1.99.1
- name: setup verusfmt run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/verus-lang/verusfmt/releases/latest/download/verusfmt-installer.sh | sh
- name: check formatting of `dependencies` working-directory: ./dependencies run: | cargo fmt --check --manifest-path prettyplease/Cargo.toml cargo fmt --check --manifest-path syn/Cargo.toml
- name: check rustfmt/verusfmt working-directory: ./source run: | cargo run -p cargo-verus -- fmt --check cargo run -p cargo-verus -- fmt --check --manifest-path vstd/Cargo.toml
- name: check cargo fmt for vargo working-directory: ./tools/vargo run: cargo fmt -- --check
# run linter (clippy) clippy: runs-on: ubuntu-24.04 steps: - name: checkout uses: actions/checkout@v6
- name: setup rust uses: dtolnay/rust-toolchain@master with: toolchain: 1.99.1 components: clippy
- name: clippy check codebase working-directory: ./source run: cargo clippy -- -D warnings
- name: clippy check vargo working-directory: ./tools/vargo run: cargo clippy -- -D warnings
# smoke test toolchain manifest creation create-manifest-smoke-test: runs-on: ubuntu-24.04 steps: - name: checkout uses: actions/checkout@v6
- name: setup rust uses: dtolnay/rust-toolchain@master with: toolchain: 1.96.0
- name: smoke test create-manifest working-directory: ./source run: | cargo run -p cargo-verus-toolchains --bin create-manifest -- --write-to-dir cargo-verus/toolchain-manifests cargo run -p cargo-verus-toolchains --bin create-manifest -- --rolling --write-to-dir cargo-verus/toolchain-manifests
# detect whether subprojects (e.g. cargo-verus) changed change_filter: runs-on: ubuntu-24.04 outputs: cargo_verus: ${{ steps.filter.outputs.cargo_verus }} steps: - name: checkout uses: actions/checkout@v6 with: fetch-depth: 0
- name: detect changed paths id: filter uses: dorny/paths-filter@v4 with: filters: | cargo_verus: - 'source/cargo-verus/**' - 'source/cargo-verus-toolchains/**'
# run cargo-verus (and -toolchains) tests cargo-verus-test: needs: [fmt, clippy, change_filter] runs-on: ubuntu-24.04 steps: - name: check for cargo-verus changes if: needs.change_filter.outputs.cargo_verus != 'true' run: echo "No source/cargo-verus changes detected; skipping cargo-verus tests."
- name: checkout if: needs.change_filter.outputs.cargo_verus == 'true' uses: actions/checkout@v6
- name: setup rust if: needs.change_filter.outputs.cargo_verus == 'true' uses: dtolnay/rust-toolchain@master with: toolchain: 1.99.1
- name: cargo-verus tests if: needs.change_filter.outputs.cargo_verus == 'true' working-directory: ./source run: | cargo test -p cargo-verus cargo test -p cargo-verus-toolchains
# run line_count tests line-count-test: needs: [fmt, clippy] runs-on: ubuntu-24.04 steps: - name: checkout uses: actions/checkout@v6
- name: setup rust uses: dtolnay/rust-toolchain@master with: toolchain: 1.99.1
- name: setup nextest uses: taiki-e/install-action@nextest
- name: line_count tests working-directory: ./source/tools/line_count run: cargo nextest run
# check if it builds and runs on linux, running the full test suite # (in release mode because it makes a huge difference) full-test: runs-on: ubuntu-24.04
env: CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS: true
defaults: run: shell: bash
steps: - name: checkout uses: actions/checkout@v6
- name: get z3 working-directory: ./source run: | ./tools/get-z3.sh echo z3 version `./z3 --version`
- name: get cvc5 working-directory: ./source run: | ./tools/get-cvc5.sh echo cvc5 version `./cvc5 --version`
- name: setup rust uses: dtolnay/rust-toolchain@master with: toolchain: 1.99.1
- name: setup nextest uses: taiki-e/install-action@nextest
- name: build working-directory: ./source run: | cargo clean # --bin rather than -p, which would rebuild with different features cargo run --release --bin create-manifest -- --rolling --write-to-dir cargo-verus/toolchain-manifests cargo build --release cargo run --release --bin cargo-verus -- build --release --manifest-path vstd/Cargo.toml
- name: full tests working-directory: ./source run: | # check cvc5 cargo run --release --bin rust_verify -- -V cvc5 ../examples/assorted_demo.rs cargo nextest run --release -p air cargo nextest run --release -p rust_verify_test # cvc5: multi-error reporting reads the failing assertion labels out of the model; # cvc5 returns total models, so these tests exercise label confirmation (run # at low parallelism: cvc5's rlimit is sensitive to CPU contention) VERUS_EXTRA_ARGS="-V cvc5" cargo nextest run --release -p rust_verify_test \ --test mut_refs_slices_arrays -j 4
# check if it builds and that basic tests pass on our main supported platforms basic-test: strategy: matrix: build: [macos-x86_64, linux, windows] include: - build: macos-x86_64 os: macos-15-intel - build: linux os: ubuntu-24.04 - build: windows os: windows-2022
runs-on: ${{ matrix.os }}
defaults: run: shell: bash
steps: - name: checkout uses: actions/checkout@v6
- name: get z3 working-directory: ./source run: | ./tools/get-z3.sh echo z3 version `./z3 --version`
- name: setup rust uses: dtolnay/rust-toolchain@master with: toolchain: 1.99.1
- name: setup nextest uses: taiki-e/install-action@nextest
- name: build working-directory: ./source run: | cargo clean cargo build cargo run -p cargo-verus -- build --manifest-path vstd/Cargo.toml
- name: basic tests working-directory: ./source run: | cargo nextest run -p rust_verify_test --test basic
# check if esoteric conficurations build smoke-test: strategy: matrix: features: [record-history, no-std, no-alloc, singular]
runs-on: ubuntu-24.04
defaults: run: shell: bash
steps: - name: checkout uses: actions/checkout@v6
- name: get z3 working-directory: ./source run: | ./tools/get-z3.sh echo z3 version `./z3 --version`
- name: setup rust uses: dtolnay/rust-toolchain@master with: toolchain: 1.99.1
- name: setup nextest uses: taiki-e/install-action@nextest
- name: install singular if: matrix.features == 'singular' run: | sudo apt-get update sudo apt-get install -y singular echo "VERUS_SINGULAR_PATH=$(command -v Singular)" >> "$GITHUB_ENV"
- name: build working-directory: ./source run: | cargo clean
case "${{ matrix.features }}" in "singular") cargo build --features singular cargo run -p cargo-verus -- build --manifest-path vstd/Cargo.toml ;; "record-history") cargo build --features record-history cargo run -p cargo-verus -- build --manifest-path vstd/Cargo.toml ;; "no-std") cargo build cargo run -p cargo-verus -- build --manifest-path vstd/Cargo.toml --no-default-features --features alloc cd .. # important to disable the source/.cargo/config.toml cargo build --manifest-path source/vstd/Cargo.toml --no-default-features --features alloc ;; "no-alloc") cargo build cargo run -p cargo-verus -- build --manifest-path vstd/Cargo.toml --no-default-features cd .. # important to disable the source/.cargo/config.toml cargo build --manifest-path source/vstd/Cargo.toml --no-default-features ;; esac
- name: smoke test working-directory: ./source run: | case "${{ matrix.features }}" in "singular") cargo nextest run -p air --features singular cargo nextest run -p rust_verify_test --features singular --test integer_ring cargo nextest run -p rust_verify_test --features singular --test examples -- examples_integer_ring ;; "record-history") cargo nextest run -p rust_verify_test --features record-history --test basic ;; esac
# build the documentation # will complain if there are warnings build-docs: needs: [fmt, clippy] runs-on: ubuntu-24.04 steps: - name: checkout uses: actions/checkout@v6
- name: setup rust uses: dtolnay/rust-toolchain@master with: toolchain: 1.99.1
- name: build docs working-directory: ./source run: | ./tools/get-z3.sh ./tools/docs.sh --strict # strict will complain if there are warnings
- name: setup mdbook and lychee env: MDBOOK_VERSION: 0.5.2 MDBOOK_SHA256: 084e4342ba564db270108763e404a7d1f309d932651a22484e93c0dc1a071f6d LYCHEE_VERSION: 0.24.2 LYCHEE_SHA256: 1f4e0ef7f6554a6ed33dd7ac144fb2e1bbed98598e7af973042fc5cd43951c9a run: | curl -sSfL -o mdbook.tar.gz "https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" curl -sSfL -o lychee.tar.gz "https://github.com/lycheeverse/lychee/releases/download/lychee-v${LYCHEE_VERSION}/lychee-x86_64-unknown-linux-gnu.tar.gz" echo "${MDBOOK_SHA256} mdbook.tar.gz" | sha256sum -c echo "${LYCHEE_SHA256} lychee.tar.gz" | sha256sum -c mkdir -p "$HOME/.local/bin" tar -xzf mdbook.tar.gz -C "$HOME/.local/bin" tar -xzf lychee.tar.gz --strip-components=1 -C "$HOME/.local/bin" lychee-x86_64-unknown-linux-gnu/lychee rm mdbook.tar.gz lychee.tar.gz echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: check doc links working-directory: ./source run: ./tools/check-doc-links.sh