generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 135
Add CI test for --use-local-toolchain #3074
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
Merged
jaisnan
merged 21 commits into
model-checking:main
from
jaisnan:add-ci-test-use-local-toolchain
Mar 27, 2024
Merged
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e1b35d5
Add CI test for --use-local-toolchain
jaisnan 5e216e6
Merge branch 'main' of https://github.com/model-checking/kani into ad…
jaisnan 97ba4ce
Add --help, --version and standalone simple checks
jaisnan ba50497
Check the toolchains used in bundle and custom toolchain match, to av…
jaisnan cb1e555
Add test to use bundle's toolchain version.
jaisnan 14c2c0b
Merge branch 'main' into add-ci-test-use-local-toolchain
jaisnan fadcf07
Fix yaml syntax
jaisnan 5d1f9fd
Change to use kani-latest instead
jaisnan 12698e1
Fix file path for rust rust-toolchain-version
jaisnan fb14238
add --use-local-bundle to complete setup
jaisnan 79552e1
Add outputs from previous job
jaisnan e5c5489
Download bundle
jaisnan 08cc1ac
Add test-local-toolchain to setup
jaisnan 16196a8
Merge branch 'main' into add-ci-test-use-local-toolchain
jaisnan 5d9322a
Merge branch 'main' of https://github.com/model-checking/kani into ad…
jaisnan e630a52
Fix custom toolchain dir
jaisnan 109fc7f
Merge branch 'add-ci-test-use-local-toolchain' of https://github.com/…
jaisnan ca72c38
Add rustc version from bundle
jaisnan a9bf208
formatting
jaisnan efbe192
Test LocalBundle without re-installing
jaisnan eeb64c5
Try with tar and verifier
jaisnan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,191 @@ | ||
| # Copyright Kani Contributors | ||
| # SPDX-License-Identifier: Apache-2.0 OR MIT | ||
| # | ||
| # Job to check if the setup flow and associated flags are working as expected | ||
| # | ||
| # This will run everytime there's a change to main | ||
| name: Check Setup | ||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - 'main' | ||
|
|
||
| jobs: | ||
| build_bundle_macos: | ||
| name: BuildBundle-MacOs | ||
| runs-on: macos-13 | ||
| permissions: | ||
| contents: write | ||
| outputs: | ||
| version: ${{ steps.bundle.outputs.version }} | ||
| bundle: ${{ steps.bundle.outputs.bundle }} | ||
| package: ${{ steps.bundle.outputs.package }} | ||
| crate_version: ${{ steps.bundle.outputs.crate_version }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Kani Dependencies | ||
| uses: ./.github/actions/setup | ||
| with: | ||
| os: macos-13 | ||
|
|
||
| - name: Build bundle | ||
| id: bundle | ||
| uses: ./.github/actions/build-bundle | ||
| with: | ||
| os: macos-13 | ||
| arch: x86_64-apple-darwin | ||
|
|
||
| build_bundle_linux: | ||
| name: BuildBundle-Linux | ||
| runs-on: ubuntu-20.04 | ||
| outputs: | ||
| # The bundle version (latest or the version to be released) | ||
| version: ${{ steps.bundle.outputs.version }} | ||
| bundle: ${{ steps.bundle.outputs.bundle }} | ||
| package: ${{ steps.bundle.outputs.package }} | ||
| crate_version: ${{ steps.bundle.outputs.crate_version }} | ||
| container: | ||
| # Build using ubuntu 18 due to compatibility issues with older OS. | ||
| image: ubuntu:18.04 | ||
| volumes: | ||
| - /usr/local:/mnt/host-local | ||
| steps: | ||
|
|
||
| - name: Free up docker disk space | ||
| run: | | ||
| # inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml | ||
| df -h | ||
| rm -r /mnt/host-local/lib/android /mnt/host-local/.ghcup | ||
| df -h | ||
|
|
||
| # This is required before checkout because the container does not | ||
| # have Git installed, so cannot run checkout action. | ||
| # The checkout action requires Git >=2.18 and python 3.7, so use the Git maintainers' PPA. | ||
| # and the "deadsnakes" PPA, as the default version of python on ubuntu 22.04 is Python 3.10 | ||
| - name: Install system dependencies | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y software-properties-common apt-utils | ||
| add-apt-repository ppa:git-core/ppa | ||
| add-apt-repository ppa:deadsnakes/ppa | ||
| apt-get update | ||
| apt-get install -y \ | ||
| build-essential bash-completion curl lsb-release sudo g++ gcc flex \ | ||
| bison make patch git python3.7 python3.7-dev python3.7-distutils | ||
| update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 | ||
| curl -s https://bootstrap.pypa.io/get-pip.py -o get-pip.py | ||
| python3 get-pip.py --force-reinstall | ||
| rm get-pip.py | ||
|
|
||
| - name: Checkout Kani | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Kani Dependencies | ||
| uses: ./.github/actions/setup | ||
| with: | ||
| os: ubuntu-18.04 | ||
|
|
||
| - name: Build bundle | ||
| id: bundle | ||
| uses: ./.github/actions/build-bundle | ||
| with: | ||
| os: linux | ||
| arch: x86_64-unknown-linux-gnu | ||
|
|
||
| test-use-local-toolchain: | ||
| name: TestLocalToolchain | ||
| needs: [build_bundle_macos, build_bundle_linux] | ||
| strategy: | ||
| matrix: | ||
| os: [macos-13, ubuntu-20.04, ubuntu-22.04] | ||
| include: | ||
| - os: macos-13 | ||
| rust_target: x86_64-apple-darwin | ||
| prev_job: ${{ needs.build_bundle_macos.outputs }} | ||
| - os: ubuntu-20.04 | ||
| rust_target: x86_64-unknown-linux-gnu | ||
| prev_job: ${{ needs.build_bundle_linux.outputs }} | ||
| - os: ubuntu-22.04 | ||
| rust_target: x86_64-unknown-linux-gnu | ||
| prev_job: ${{ needs.build_bundle_linux.outputs }} | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout Kani under "kani" | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: kani | ||
|
|
||
| - name: Setup Kani Dependencies | ||
| uses: ./kani/.github/actions/setup | ||
| with: | ||
| os: ${{ matrix.os }} | ||
| kani_dir: 'kani' | ||
|
|
||
| - name: Build Kani | ||
| run: cargo install --locked --path ./kani | ||
jaisnan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Download bundle | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: ${{ matrix.prev_job.bundle }} | ||
|
|
||
| - name: Check download | ||
| run: | | ||
| ls -lh . | ||
|
|
||
| - name: Get toolchain version used to setup kani | ||
| run: | | ||
| tar zxvf ${{ matrix.prev_job.bundle }} | ||
| DATE=$(cat ./kani-latest/rust-toolchain-version | cut -d'-' -f2,3,4) | ||
| echo "Nightly date: $DATE" | ||
| echo "DATE=$DATE" >> $GITHUB_ENV | ||
|
|
||
| - name: Install Kani from path | ||
| run: | | ||
| cargo install --locked --path kani-verifier-${{ matrix.prev_job.crate_version }} | ||
|
|
||
| - name: Create a custom toolchain directory | ||
| run: mkdir -p ${{ github.workspace }}/custom_toolchain | ||
|
|
||
| - name: Fetch the nightly tarball | ||
| run: | | ||
| echo "Downloading Rust toolchain from rust server." | ||
| curl --proto '=https' --tlsv1.2 -O https://static.rust-lang.org/dist/$DATE/rust-nightly-${{ matrix.rust_target }}.tar.gz | ||
| tar -xzf rust-nightly-${{ matrix.rust_target }}.tar.gz | ||
| ./rust-nightly-${{ matrix.rust_target }}/install.sh --prefix=${{ github.workspace }}/custom_toolchain | ||
|
|
||
| - name: Ensure installation is correct | ||
| run: | | ||
| cargo kani setup --use-local-bundle ./${{ matrix.prev_job.bundle }} --use-local-toolchain ${{ github.workspace }}/custom_toolchain/ | ||
|
|
||
| - name: Ensure that the rustup toolchain is not present | ||
| run: | | ||
| if [ ! -e "~/.rustup/toolchains/" ]; then | ||
| echo "Default toolchain file does not exist. Proceeding with running tests." | ||
| else | ||
| echo "::error::Default toolchain exists despite not installing." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Run cargo-kani tests | ||
| run: | | ||
| for dir in function multiple-harnesses verbose; do | ||
| >&2 echo "Running test $dir" | ||
| pushd ./tests/cargo-ui/$dir | ||
jaisnan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| cargo kani | ||
jaisnan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| popd | ||
| done | ||
|
|
||
| - name: Check --help and --version | ||
| run: | | ||
| cargo kani --help && cargo kani --version | ||
|
|
||
| - name: Run standalone kani test | ||
| run: | | ||
| >&2 echo "Running test on file $dir" | ||
| pushd ./tests/kani/$dir | ||
| kani bool_ref.rs | ||
| popd | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.