|
| 1 | +# Copyright Kani Contributors |
| 2 | +# SPDX-License-Identifier: Apache-2.0 OR MIT |
| 3 | +# |
| 4 | +# This workflow will try to build and run the `verify-rust-std` repository. |
| 5 | +# |
| 6 | +# This check should be optional, but it has been added to help provide |
| 7 | +# visibility to when a PR may break the `verify-rust-std` repository. |
| 8 | +# |
| 9 | +# We expect toolchain updates to potentially break this workflow in cases where |
| 10 | +# the version tracked in the `verify-rust-std` is not compatible with newer |
| 11 | +# versions of the Rust toolchain. |
| 12 | +# |
| 13 | +# Changes unrelated to the toolchain should match the current status of main. |
| 14 | + |
| 15 | +name: Check Std Verification |
| 16 | +on: |
| 17 | + pull_request: |
| 18 | + workflow_call: |
| 19 | + |
| 20 | +env: |
| 21 | + RUST_BACKTRACE: 1 |
| 22 | + |
| 23 | +jobs: |
| 24 | + verify-std: |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + # Kani does not support windows. |
| 29 | + os: [ ubuntu-22.04, macos-14 ] |
| 30 | + steps: |
| 31 | + - name: Checkout Library |
| 32 | + uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + repository: model-checking/verify-rust-std |
| 35 | + path: verify-rust-std |
| 36 | + submodules: true |
| 37 | + |
| 38 | + - name: Checkout `Kani` |
| 39 | + uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + path: kani |
| 42 | + |
| 43 | + - name: Setup Kani Dependencies |
| 44 | + uses: ./kani/.github/actions/setup |
| 45 | + with: |
| 46 | + os: ${{ matrix.os }} |
| 47 | + kani_dir: kani |
| 48 | + |
| 49 | + - name: Build Kani |
| 50 | + working-directory: kani |
| 51 | + run: | |
| 52 | + cargo build-dev |
| 53 | + echo "$(pwd)/scripts" >> $GITHUB_PATH |
| 54 | +
|
| 55 | + - name: Run verification with HEAD |
| 56 | + id: check-head |
| 57 | + working-directory: verify-rust-std |
| 58 | + continue-on-error: true |
| 59 | + run: | |
| 60 | + kani verify-std -Z unstable-options ./library --target-dir ${{ runner.temp }} -Z function-contracts \ |
| 61 | + -Z mem-predicates -Z ptr-to-ref-cast-checks |
| 62 | +
|
| 63 | + # If the head failed, check if it's a new failure. |
| 64 | + - name: Checkout base |
| 65 | + working-directory: kani |
| 66 | + if: steps.check-head.outcome != 'success' && github.event_name == 'pull_request' |
| 67 | + run: | |
| 68 | + BASE_REF=${{ github.event.pull_request.base.sha }} |
| 69 | + git checkout ${BASE_REF} |
| 70 | + cargo build-dev |
| 71 | +
|
| 72 | + - name: Run verification with BASE |
| 73 | + id: check-base |
| 74 | + if: steps.check-head.outcome != 'success' && github.event_name == 'pull_request' |
| 75 | + working-directory: verify-rust-std |
| 76 | + continue-on-error: true |
| 77 | + run: | |
| 78 | + kani verify-std -Z unstable-options ./library --target-dir ${{ runner.temp }} -Z function-contracts \ |
| 79 | + -Z mem-predicates -Z ptr-to-ref-cast-checks |
| 80 | +
|
| 81 | + - name: Compare PR results |
| 82 | + if: steps.check-head.outcome != 'success' && steps.check-head.output != github.check-base.output |
| 83 | + run: | |
| 84 | + echo "New failure introduced by this change" |
| 85 | + exit 1 |
| 86 | +
|
0 commit comments