-
Notifications
You must be signed in to change notification settings - Fork 114
126 lines (118 loc) · 4.58 KB
/
rust.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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