-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR updates the action to add the parameter for kani-version which defaults to the value latest. The default value latest uses the latest version of Kani that is uploaded on crates.io unless a specific version is provided by the user, in which case that specific version of Kani will be used in the CI.
- Loading branch information
Showing
4 changed files
with
183 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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,39 @@ | ||
#!/bin/bash | ||
# Copyright Kani Contributors | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
# If version is latest, install directly from cargo | ||
if [ "$1" == "latest" ]; then | ||
cargo install --locked kani-verifier; | ||
else | ||
VERSION=$1 | ||
cargo install --version $VERSION --locked kani-verifier; | ||
fi | ||
|
||
# Check exit status for error handling | ||
if [ $? -eq 0 ]; then | ||
echo "Installed Kani $VERSION successfully" | ||
else | ||
echo "::error::Could not install Kani. Please check if the provided version is correct" | ||
exit 1 | ||
fi | ||
|
||
# Setup kani in ci | ||
cargo-kani setup; | ||
|
||
# Get the current installed version of kani and check it against the latest version | ||
installed_version=$(kani --version | awk '{print $2}') | ||
|
||
if [$? -eq 0]; then | ||
if [ "$1" == "latest" ]; then | ||
# Cargo search returns version number as string | ||
requested_version=$(cargo search kani-verifier | grep -m 1 "^kani-verifier " | awk '{print $3}') | ||
else | ||
requested_version=$1 | ||
fi | ||
|
||
if ["$installed_version" != "$requested_version"]; then | ||
echo "::error::The version of Kani installed was different than the one requested" | ||
exit 1 | ||
fi | ||
fi |