Skip to content

Commit

Permalink
CI: Install SMT solvers
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGlScott committed Jan 9, 2025
1 parent cca76e9 commit ae96882
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/ci.sh
Original file line number Diff line number Diff line change
@@ -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" "$@"
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit ae96882

Please sign in to comment.