Skip to content

Use downloaded Z3 binary by default when static-link-z3 flag is active #396

Use downloaded Z3 binary by default when static-link-z3 flag is active

Use downloaded Z3 binary by default when static-link-z3 flag is active #396

Workflow file for this run

name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_INCREMENTAL: 0
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
RUSTFLAGS: "-D warnings"
Z3_RELEASE: 'z3-4.12.1'
RUST_BACKTRACE: 'full'
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check formatting
run: cargo fmt -- --check
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
link: [download, build, system]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
uses: KyleMayes/install-llvm-action@v1
if: runner.os == 'Windows'
with:
version: "11.0"
directory: ${{ runner.temp }}/llvm
- name: install c++ runtime on windows
if: runner.os == 'Windows'
shell: bash
run: |
choco install vcredist2017
echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
- name: Uninstall Z3 on Linux for non-system builds
if: runner.os == 'Linux' && matrix.link != 'system'
run: sudo apt-get remove libz3-dev
- name: Setup homebrew (macOS)
if: runner.os == 'macOS' && matrix.link == 'system'
shell: bash
run: |
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
- name: Install Z3 (macOS)
if: runner.os == 'macOS' && matrix.link == 'system'
shell: bash
run: (yes || true) | brew install z3
- name: Install Z3 on Windows for system builds
if: startsWith(matrix.os, 'windows-') && matrix.link == 'system'
run: |
mkdir .tmp
curl.exe -L "https://github.com/Z3Prover/z3/releases/download/${env:Z3_RELEASE}/${env:Z3_RELEASE}-x64-win.zip" -o ".tmp/${env:Z3_RELEASE}-x64-win.zip"
tar -xf ".tmp/${env:Z3_RELEASE}-x64-win.zip" -C ".tmp"
echo "${PWD}\.tmp\${env:Z3_RELEASE}-x64-win\bin" >> $env:GITHUB_PATH
echo "LIB=${PWD}\.tmp\${env:Z3_RELEASE}-x64-win\bin" >> $env:GITHUB_ENV
echo "Z3_SYS_Z3_HEADER=${PWD}\.tmp\${env:Z3_RELEASE}-x64-win\include\z3.h" >> $env:GITHUB_ENV
- name: Config rust for windows
if: matrix.os == 'windows-latest'
run: rustup set default-host x86_64-pc-windows-msvc
- id: build-param
shell: bash
run: |
case "${{ matrix.link }}" in
"system" ) echo "param=" >> $GITHUB_OUTPUT ;;
"build" ) echo "param=--features force-build-z3" >> $GITHUB_OUTPUT ;;
"download" ) echo "param=--features static-link-z3" >> $GITHUB_OUTPUT ;;
esac
- name: Build
run: cargo build -vv --workspace --all-targets ${{ steps.build-param.outputs.param }}
# Avoid to run rustdoc tests due to toolchain bug (https://github.com/rust-lang/cargo/issues/8531)
- name: Run tests (non-Windows)
if: runner.os != 'Windows'
run: cargo test -vv --workspace ${{ steps.build-param.outputs.param }}
- name: Run tests (Windows)
if: runner.os == 'Windows'
run: cargo test -vv --workspace --tests ${{ steps.build-param.outputs.param }}
- name: Run tests with `arbitrary-size-numeral` enabled (non-Windows)
if: runner.os != 'Windows'
run: cargo test --manifest-path z3/Cargo.toml -vv --features=arbitrary-size-numeral ${{ steps.build-param.outputs.param }}
- name: Run tests with `arbitrary-size-numeral` enabled (Windows)
if: runner.os == 'Windows'
run: cargo test --manifest-path z3/Cargo.toml --tests -vv --features=arbitrary-size-numeral ${{ steps.build-param.outputs.param }}
build_on_wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install emscripten
run: |
cd ~
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git pull
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
- name: Install wasm32-unknown-emscripten target
run: rustup target add wasm32-unknown-emscripten
- name: Build z3-sys and z3 with statically linked Z3
run: |
source ~/emsdk/emsdk_env.sh
cargo build --target=wasm32-unknown-emscripten -vv --features static-link-z3
run_clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Run clippy
run: cargo clippy -vv --features static-link-z3 --all-targets