4444 os : macos-13
4545 arch : x86_64-apple-darwin
4646
47+ build_bundle_macos_aarch64 :
48+ name : BuildBundle-MacOs-ARM
49+ runs-on : macos-14
50+ permissions :
51+ contents : write
52+ outputs :
53+ version : ${{ steps.bundle.outputs.version }}
54+ bundle : ${{ steps.bundle.outputs.bundle }}
55+ package : ${{ steps.bundle.outputs.package }}
56+ crate_version : ${{ steps.bundle.outputs.crate_version }}
57+ steps :
58+ - name : Checkout code
59+ uses : actions/checkout@v4
60+
61+ - name : Setup Kani Dependencies
62+ uses : ./.github/actions/setup
63+ with :
64+ os : macos-14
65+
66+ - name : Build bundle
67+ id : bundle
68+ uses : ./.github/actions/build-bundle
69+ with :
70+ os : macos-14
71+ arch : aarch64-apple-darwin
72+
4773 build_bundle_linux :
4874 name : BuildBundle-Linux
4975 runs-on : ubuntu-20.04
82108 build-essential bash-completion curl lsb-release sudo g++ gcc flex \
83109 bison make patch git python3.7 python3.7-dev python3.7-distutils
84110 update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
85- curl -s https://bootstrap.pypa.io/get-pip.py -o get-pip.py
111+ curl -s https://bootstrap.pypa.io/pip/3.7/ get-pip.py -o get-pip.py
86112 python3 get-pip.py --force-reinstall
87113 rm get-pip.py
88114
@@ -101,6 +127,106 @@ jobs:
101127 os : linux
102128 arch : x86_64-unknown-linux-gnu
103129
130+ test-use-local-toolchain :
131+ name : TestLocalToolchain
132+ needs : [build_bundle_macos, build_bundle_linux]
133+ strategy :
134+ matrix :
135+ os : [macos-13, ubuntu-20.04, ubuntu-22.04]
136+ include :
137+ - os : macos-13
138+ rust_target : x86_64-apple-darwin
139+ prev_job : ${{ needs.build_bundle_macos.outputs }}
140+ - os : ubuntu-20.04
141+ rust_target : x86_64-unknown-linux-gnu
142+ prev_job : ${{ needs.build_bundle_linux.outputs }}
143+ - os : ubuntu-22.04
144+ rust_target : x86_64-unknown-linux-gnu
145+ prev_job : ${{ needs.build_bundle_linux.outputs }}
146+ runs-on : ${{ matrix.os }}
147+ steps :
148+ - name : Download bundle
149+ uses : actions/download-artifact@v3
150+ with :
151+ name : ${{ matrix.prev_job.bundle }}
152+
153+ - name : Download kani-verifier crate
154+ uses : actions/download-artifact@v3
155+ with :
156+ name : ${{ matrix.prev_job.package }}
157+
158+ - name : Check download
159+ run : |
160+ ls -lh .
161+
162+ - name : Get toolchain version used to setup kani
163+ run : |
164+ tar zxvf ${{ matrix.prev_job.bundle }}
165+ DATE=$(cat ./kani-${{ matrix.prev_job.version }}/rust-toolchain-version | cut -d'-' -f2,3,4)
166+ echo "Nightly date: $DATE"
167+ echo "DATE=$DATE" >> $GITHUB_ENV
168+
169+ - name : Install Kani from path
170+ run : |
171+ tar zxvf ${{ matrix.prev_job.package }}
172+ cargo install --locked --path kani-verifier-${{ matrix.prev_job.crate_version }}
173+
174+ - name : Create a custom toolchain directory
175+ run : mkdir -p ${{ github.workspace }}/../custom_toolchain
176+
177+ - name : Fetch the nightly tarball
178+ run : |
179+ echo "Downloading Rust toolchain from rust server."
180+ curl --proto '=https' --tlsv1.2 -O https://static.rust-lang.org/dist/$DATE/rust-nightly-${{ matrix.rust_target }}.tar.gz
181+ tar -xzf rust-nightly-${{ matrix.rust_target }}.tar.gz
182+ ./rust-nightly-${{ matrix.rust_target }}/install.sh --prefix=${{ github.workspace }}/../custom_toolchain
183+
184+ - name : Ensure installation is correct
185+ run : |
186+ cargo kani setup --use-local-bundle ./${{ matrix.prev_job.bundle }} --use-local-toolchain ${{ github.workspace }}/../custom_toolchain/
187+
188+ - name : Ensure that the rustup toolchain is not present
189+ run : |
190+ if [ ! -e "~/.rustup/toolchains/" ]; then
191+ echo "Default toolchain file does not exist. Proceeding with running tests."
192+ else
193+ echo "::error::Default toolchain exists despite not installing."
194+ exit 1
195+ fi
196+
197+ - name : Checkout tests
198+ uses : actions/checkout@v4
199+
200+ - name : Move rust-toolchain file to outside kani
201+ run : |
202+ mkdir -p ${{ github.workspace }}/../post-setup-tests
203+ cp -r tests/cargo-ui ${{ github.workspace }}/../post-setup-tests
204+ cp -r tests/kani/Assert ${{ github.workspace }}/../post-setup-tests
205+ ls ${{ github.workspace }}/../post-setup-tests
206+
207+ - name : Run cargo-kani tests after moving
208+ run : |
209+ for dir in supported-lib-types/rlib multiple-harnesses verbose; do
210+ >&2 echo "Running test $dir"
211+ pushd ${{ github.workspace }}/../post-setup-tests/cargo-ui/$dir
212+ cargo kani
213+ popd
214+ done
215+
216+ - name : Check --help and --version
217+ run : |
218+ >&2 echo "Running cargo kani --help and --version"
219+ pushd ${{ github.workspace }}/../post-setup-tests/Assert
220+ cargo kani --help && cargo kani --version
221+ popd
222+
223+ - name : Run standalone kani test
224+ run : |
225+ >&2 echo "Running test on file bool_ref"
226+ pushd ${{ github.workspace }}/../post-setup-tests/Assert
227+ kani bool_ref.rs
228+ popd
229+
104230 test_bundle :
105231 name : TestBundle
106232 needs : [build_bundle_macos, build_bundle_linux]
@@ -284,7 +410,7 @@ jobs:
284410 OWNER : ' ${{ github.repository_owner }}'
285411
286412 - name : Build and push
287- uses : docker/build-push-action@v5
413+ uses : docker/build-push-action@v6
288414 with :
289415 context : .
290416 file : scripts/ci/Dockerfile.bundle-release-20-04
0 commit comments