@@ -2,14 +2,16 @@ name: Rust
2
2
3
3
on :
4
4
push :
5
- branches : [ master ]
5
+ branches : [ master , download_z3 ]
6
6
pull_request :
7
7
branches : [ master ]
8
8
9
9
env :
10
10
CARGO_INCREMENTAL : 0
11
11
CARGO_REGISTRIES_CRATES_IO_PROTOCOL : sparse
12
12
RUSTFLAGS : " -D warnings"
13
+ Z3_RELEASE : ' z3-4.12.1'
14
+ RUST_BACKTRACE : ' full'
13
15
14
16
jobs :
15
17
check-formatting :
@@ -20,26 +22,77 @@ jobs:
20
22
run : cargo fmt -- --check
21
23
22
24
build :
23
- runs-on : ubuntu-latest
25
+ strategy :
26
+ fail-fast : false
27
+ matrix :
28
+ os : [ubuntu-latest, windows-latest, macos-latest]
29
+ link : [download, build, system]
30
+ runs-on : ${{ matrix.os }}
24
31
steps :
25
32
- uses : actions/checkout@v3
26
- - name : Install Z3
27
- run : sudo apt-get install libz3-dev
33
+ with :
34
+ submodules : recursive
35
+ - name : Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
36
+ uses : KyleMayes/install-llvm-action@v1
37
+ if : runner.os == 'Windows'
38
+ with :
39
+ version : " 11.0"
40
+ directory : ${{ runner.temp }}/llvm
41
+ - name : install c++ runtime on windows
42
+ if : runner.os == 'Windows'
43
+ shell : bash
44
+ run : |
45
+ choco install vcredist2017
46
+ echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
47
+ - name : Uninstall Z3 on Linux for non-system builds
48
+ if : runner.os == 'Linux' && matrix.link != 'system'
49
+ run : sudo apt-get remove libz3-dev
50
+ - name : Setup homebrew (macOS)
51
+ if : runner.os == 'macOS' && matrix.link == 'system'
52
+ shell : bash
53
+ run : |
54
+ echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
55
+ - name : Install Z3 (macOS)
56
+ if : runner.os == 'macOS' && matrix.link == 'system'
57
+ shell : bash
58
+ run : (yes || true) | brew install z3
59
+
60
+ - name : Install Z3 on Windows for system builds
61
+ if : startsWith(matrix.os, 'windows-') && matrix.link == 'system'
62
+ run : |
63
+ mkdir .tmp
64
+ 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"
65
+ tar -xf ".tmp/${env:Z3_RELEASE}-x64-win.zip" -C ".tmp"
66
+ echo "${PWD}\.tmp\${env:Z3_RELEASE}-x64-win\bin" >> $env:GITHUB_PATH
67
+ echo "LIB=${PWD}\.tmp\${env:Z3_RELEASE}-x64-win\bin" >> $env:GITHUB_ENV
68
+ echo "Z3_SYS_Z3_HEADER=${PWD}\.tmp\${env:Z3_RELEASE}-x64-win\include\z3.h" >> $env:GITHUB_ENV
69
+ - name : Config rust for windows
70
+ if : matrix.os == 'windows-latest'
71
+ run : rustup set default-host x86_64-pc-windows-msvc
72
+
73
+ - id : build-param
74
+ shell : bash
75
+ run : |
76
+ case "${{ matrix.link }}" in
77
+ "system" ) echo "param=" >> $GITHUB_OUTPUT ;;
78
+ "build" ) echo "param=--features force-build-z3" >> $GITHUB_OUTPUT ;;
79
+ "download" ) echo "param=--features static-link-z3" >> $GITHUB_OUTPUT ;;
80
+ esac
28
81
- name : Build
29
- run : cargo build -vv --all
30
- # XXX: Ubuntu's Z3 package seems to be missing some symbols, like
31
- # `Z3_mk_pbeq`, leading to linker errors. Just ignore this, I guess, until
32
- # we figure out how to work around it. At least we have the
33
- # statically-linked Z3 tests below...
34
- if : ${{ success() || failure() }}
35
- - name : Run tests
36
- run : cargo test -vv --all
37
- # See above.
38
- if : ${{ success() || failure() }}
39
- - name : Run tests with ` arbitrary-size-numeral` enabled
40
- run : cargo test --manifest-path z3/Cargo.toml -vv --features arbitrary-size-numeral
41
- # See above.
42
- if : ${{ success() || failure() }}
82
+ run : cargo build -vv --workspace -- all-targets ${{ steps.build-param.outputs.param }}
83
+ # Avoid to run rustdoc tests due to toolchain bug (https://github.com/rust-lang/cargo/issues/8531)
84
+ - name : Run tests (non-Windows)
85
+ if : runner.os != 'Windows'
86
+ run : cargo test -vv --workspace ${{ steps.build-param.outputs.param }}
87
+ - name : Run tests (Windows)
88
+ if : runner.os == 'Windows'
89
+ run : cargo test -vv --workspace --tests ${{ steps.build-param.outputs.param }}
90
+ - name : Run tests with `arbitrary-size-numeral` enabled (non-Windows)
91
+ if : runner.os != 'Windows'
92
+ run : cargo test --manifest-path z3/Cargo.toml -vv --features= arbitrary-size-numeral ${{ steps.build-param.outputs.param }}
93
+ - name : Run tests with ` arbitrary-size-numeral` enabled (Windows)
94
+ if : runner.os == 'Windows'
95
+ run : cargo test --manifest-path z3/Cargo.toml --tests -vv --features=arbitrary-size-numeral ${{ steps.build-param.outputs.param }}
43
96
44
97
build_on_wasm :
45
98
runs-on : ubuntu-latest
@@ -63,38 +116,6 @@ jobs:
63
116
source ~/emsdk/emsdk_env.sh
64
117
cargo build --target=wasm32-unknown-emscripten -vv --features static-link-z3
65
118
66
- build_z3_statically :
67
- strategy :
68
- matrix :
69
- build : [linux, macos, windows]
70
- include :
71
- - build : linux
72
- os : ubuntu-latest
73
- - build : macos
74
- os : macos-latest
75
- - build : windows
76
- os : windows-latest
77
- runs-on : ${{ matrix.os }}
78
- steps :
79
- - uses : actions/checkout@v3
80
- with :
81
- submodules : recursive
82
- - name : Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
83
- uses : KyleMayes/install-llvm-action@v1
84
- if : matrix.os == 'windows-latest'
85
- with :
86
- version : " 11.0"
87
- directory : ${{ runner.temp }}/llvm
88
- - name : Set LIBCLANG_PATH
89
- run : echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
90
- if : matrix.os == 'windows-latest'
91
- - name : Build `z3-sys` and `z3` with statically linked Z3
92
- run : cargo build -vv --features static-link-z3
93
- - name : Test `z3-sys` and `z3` with statically linked Z3
94
- run : cargo test -vv --features static-link-z3
95
- - name : Test `z3` with statically linked Z3 and `arbitrary-size-numeral` enabled
96
- run : cargo test --manifest-path z3/Cargo.toml -vv --features 'static-link-z3 arbitrary-size-numeral'
97
-
98
119
run_clippy :
99
120
runs-on : ubuntu-latest
100
121
steps :
0 commit comments