diff --git a/.github/ci.sh b/.github/ci.sh new file mode 100755 index 0000000..4db364f --- /dev/null +++ b/.github/ci.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +set -Eeuxo pipefail + +DATE=$(date "+%Y-%m-%d") +[[ "$RUNNER_OS" == 'Windows' ]] && IS_WIN=true || IS_WIN=false +BIN=bin +EXT="" +$IS_WIN && EXT=".exe" +mkdir -p "$BIN" + +is_exe() { [[ -x "$1/$2$EXT" ]] || command -v "$2" > /dev/null 2>&1; } + +install_solvers() { + (cd $BIN && curl -o bins.zip -sL "https://github.com/GaloisInc/what4-solvers/releases/download/$SOLVER_PKG_VERSION/$BUILD_TARGET_OS-$BUILD_TARGET_ARCH-bin.zip" && unzip -o bins.zip && rm bins.zip) + cp $BIN/yices_smt2$EXT $BIN/yices-smt2$EXT + chmod +x $BIN/* +} + +install_system_deps() { + install_solvers + export PATH=$PWD/$BIN:$PATH + echo "$PWD/$BIN" >> $GITHUB_PATH + is_exe "$BIN" boolector && \ + is_exe "$BIN" bitwuzla && \ + is_exe "$BIN" cvc4 && \ + is_exe "$BIN" cvc5 && \ + is_exe "$BIN" yices && \ + is_exe "$BIN" z3 +} + +COMMAND="$1" +shift + +"$COMMAND" "$@" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d51aee2..b69ae7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ permissions: contents: read env: + SOLVER_PKG_VERSION: "snapshot-20241119" # The NAME makes it easier to copy/paste snippets from other CI configs NAME: stubs @@ -94,6 +95,14 @@ jobs: key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} restore-keys: ${{ env.key }}- + - shell: bash + name: Install system dependencies + run: .github/ci.sh install_system_deps + env: + BIN_ZIP_FILE: ${{ matrix.os }}-bin.zip + BUILD_TARGET_OS: ${{ matrix.os }} + BUILD_TARGET_ARCH: ${{ runner.arch }} + - name: Configure run: cabal configure -j2 --enable-tests