diff --git a/action.yml b/action.yml index 641ea53..080dc81 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,10 @@ branding: color: 'orange' inputs: + kani-version: + description: 'Kani Version number' + required: false + default: 'latest' command: description: 'Command to run.' required: false @@ -36,9 +40,9 @@ runs: - name: Install Kani shell: bash run: | - export KANI_VERSION="0.35.0"; - cargo install --version $KANI_VERSION --locked kani-verifier; - cargo-kani setup; + cd "$GITHUB_WORKSPACE" + pwd + ./install-kani.sh {{ inputs.kani-version }} - name: Install PropProof if: ${{ inputs.enable-propproof == 'true' }} diff --git a/install-kani.sh b/install-kani.sh new file mode 100755 index 0000000..c263cde --- /dev/null +++ b/install-kani.sh @@ -0,0 +1,20 @@ +#!/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 [ $? -ne O ]; then + echo "Error installing Kani. Please check if the provided version is correct" + exit 1 +fi + +# Setup kani in ci +cargo-kani setup;