Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload z3 built by vcpkg as release assets in CI. Maybe test whether it works in CI later. #264

Draft
wants to merge 63 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
163f80c
Add basic support for vcpkg.
TheVeryDarkness Oct 13, 2023
0df54a2
Improve support for wasm32.
TheVeryDarkness Oct 13, 2023
0b30251
Fix a warning.
TheVeryDarkness Oct 13, 2023
651f28c
Make clippy happy
TheVeryDarkness Oct 13, 2023
c284d15
Merge remote-tracking branch 'upstream/master' into add-vcpkg
TheVeryDarkness Oct 18, 2023
2d8d63f
Refactor the process.
TheVeryDarkness Oct 18, 2023
02de1e7
Added a ci test for vcpkg-installed z3
TheVeryDarkness Oct 18, 2023
7716650
Fix mistakes in ci
TheVeryDarkness Oct 18, 2023
e4bcbdc
Merge remote-tracking branch 'upstream' into add-vcpkg
TheVeryDarkness Oct 18, 2023
ed6b65b
Rename build_z3 to build_bundled_z3
TheVeryDarkness Oct 18, 2023
728b962
Revert "Improve support for wasm32."
TheVeryDarkness Oct 18, 2023
8eedfa7
Merge branch 'add-vcpkg' of https://github.com/TheVeryDarkness/z3.rs …
TheVeryDarkness Oct 18, 2023
d10c623
Merge branch 'add-vcpkg' of https://github.com/TheVeryDarkness/z3.rs …
TheVeryDarkness Oct 18, 2023
d4d3164
Fix an error in build script.
TheVeryDarkness Oct 18, 2023
a31eb7f
Fix an error in ci
TheVeryDarkness Oct 18, 2023
9f0bd1d
Fixing ci errors.
TheVeryDarkness Oct 18, 2023
a5b44da
Force to set VCPKG_ROOT in CI
TheVeryDarkness Oct 18, 2023
ecb607b
Remove macos and a redundant step from workflows
TheVeryDarkness Oct 18, 2023
63aa222
No fail fast
TheVeryDarkness Oct 18, 2023
6c0f856
Test on windows only.
TheVeryDarkness Oct 18, 2023
25a913e
Clean build trees after build.
TheVeryDarkness Oct 18, 2023
e5244a6
Test only on Windows indeed.
TheVeryDarkness Oct 18, 2023
bfb6a46
Show default toolchain of rust.
TheVeryDarkness Oct 18, 2023
d164579
Merge remote-tracking branch 'upstream/master'
TheVeryDarkness Oct 18, 2023
954a72f
CI: Update to `actions/checkout@v4`.
TheVeryDarkness Oct 18, 2023
8094dbf
CI: Avoid redundant line breaking and spaces.
TheVeryDarkness Oct 18, 2023
73a27e4
Update documentation about feature `vcpkg`
TheVeryDarkness Oct 18, 2023
c4c417d
Change `statically linked` to `bundled`.
TheVeryDarkness Oct 20, 2023
c1e7eaa
Try compressing z3 library
TheVeryDarkness Oct 26, 2023
77c8267
Fix an error in CI
TheVeryDarkness Oct 26, 2023
25c624b
Fix some errors in CI
TheVeryDarkness Oct 26, 2023
5b79ce2
A preliminary CI
TheVeryDarkness Oct 26, 2023
e7ab918
Use a script to generate CI.
TheVeryDarkness Oct 26, 2023
d5a912f
Fix an error in CI about release name
TheVeryDarkness Oct 26, 2023
ec05154
Disable cache
TheVeryDarkness Oct 26, 2023
049ad95
Fix an error in CI
TheVeryDarkness Oct 26, 2023
896de47
Implement vcpkg action by ourselves
TheVeryDarkness Oct 27, 2023
fce05af
Include z3++.h in artifacts
TheVeryDarkness Oct 27, 2023
1805f7c
Manually triger the workflow.
TheVeryDarkness Oct 27, 2023
b7d42f3
Deprecating make_artifact.sh
TheVeryDarkness Oct 27, 2023
53cf9c3
Simplified prebuild.yml and deprecated make_artifact.sh
TheVeryDarkness Oct 27, 2023
01f1486
Simplify an echo in rust.yml
TheVeryDarkness Oct 27, 2023
6349e6c
Automatically triger the workflow.
TheVeryDarkness Oct 27, 2023
888d58e
Fix an error in CI
TheVeryDarkness Oct 27, 2023
f7821e5
Another way to get and upload built files.
TheVeryDarkness Oct 27, 2023
5f651d2
Merge remote-tracking branch 'upstream/master'
TheVeryDarkness Oct 27, 2023
5f35d49
Merge branch 'upload-prebuilt-static-z3'
TheVeryDarkness Oct 27, 2023
ddb8af8
Fix an error in CI.
TheVeryDarkness Oct 27, 2023
fe7828f
Avoid too complex logic in CI
TheVeryDarkness Oct 27, 2023
bd832bb
Fixing an error in CI on Windows
TheVeryDarkness Oct 27, 2023
63987ba
CI: Hard code copied files.
TheVeryDarkness Oct 28, 2023
8a362ae
Use python shell to collect and compress.
TheVeryDarkness Oct 28, 2023
475f4d6
Fix an error in CI.
TheVeryDarkness Oct 28, 2023
40090f7
Fix an error in CI.
TheVeryDarkness Oct 28, 2023
b0d0370
Fix an error in CI
TheVeryDarkness Oct 28, 2023
4a99f76
Fix escape in python script; use python 3.10
TheVeryDarkness Oct 28, 2023
afa2a92
Fix an error in CI
TheVeryDarkness Oct 28, 2023
d1209bd
Skip compression if archive already exists
TheVeryDarkness Oct 29, 2023
4dcfb13
Correct output case.
TheVeryDarkness Oct 29, 2023
df436df
Correcting output of Python script
TheVeryDarkness Oct 29, 2023
f5c9abc
Use another action that enables overwrite
TheVeryDarkness Oct 29, 2023
f7e32e6
Try creating a release before getting its info
TheVeryDarkness Oct 29, 2023
c0dbcbf
Traverse headers list; remove an unused step.
TheVeryDarkness Oct 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 108 additions & 41 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,52 +15,52 @@ jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt -- --check
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt -- --check

build:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Z3 (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install libz3-dev
- name: Install Z3 (macOS)
if: matrix.os == 'macos-latest'
run: brew install z3
- name: Run tests
run: cargo test --workspace
# XXX: Ubuntu's Z3 package seems to be missing some symbols, like
# `Z3_mk_pbeq`, leading to linker errors. Just ignore this, I guess, until
# we figure out how to work around it. At least we have the
# build using a bundled Z3 below...
if: ${{ success() || failure() }}
- uses: actions/checkout@v4
- name: Install Z3 (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install libz3-dev
- name: Install Z3 (macOS)
if: matrix.os == 'macos-latest'
run: brew install z3
- name: Run tests
run: cargo test --workspace
# XXX: Ubuntu's Z3 package seems to be missing some symbols, like
# `Z3_mk_pbeq`, leading to linker errors. Just ignore this, I guess, until
# we figure out how to work around it. At least we have the
# build using a bundled Z3 below...
if: ${{ success() || failure() }}

build_on_wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
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 bundled Z3
run: |
source ~/emsdk/emsdk_env.sh
cargo build --target=wasm32-unknown-emscripten --features bundled
- uses: actions/checkout@v4
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 bundled Z3
run: |
source ~/emsdk/emsdk_env.sh
cargo build --target=wasm32-unknown-emscripten --features bundled

build_with_bundled_z3:
strategy:
Expand Down Expand Up @@ -98,15 +98,19 @@ jobs:
- build: linux
os: ubuntu-latest
vcpkg_triplet: x64-linux
lib: libz3.a
- build: macos
os: macos-latest
vcpkg_triplet: x64-osx
lib: libz3.a
- build: windows
os: windows-latest
vcpkg_triplet: x64-windows-static-md
lib: libz3.lib
runs-on: ${{ matrix.os }}
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
Z3_VERSION: 0.12.2
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -120,7 +124,7 @@ jobs:
- name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: matrix.os == 'windows-latest'
- run: echo Instaling z3:${{ matrix.vcpkg_triplet }} on ${{ matrix.os }}.
- run: echo "Instaling z3:${{ matrix.vcpkg_triplet }} on ${{ matrix.os }}."
- name: vcpkg build z3
uses: johnwason/vcpkg-action@v5
id: vcpkg
Expand All @@ -135,12 +139,75 @@ jobs:
run: rustup default
- name: Test `z3-sys` and `z3` with vcpkg installed Z3
run: cargo test --workspace --features vcpkg
- name: Create Release
continue-on-error: true
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.Z3_VERSION }}
release_name: ${{ env.Z3_VERSION }}
draft: false
prerelease: false
- name: git-get-release-action
id: get_release
uses: cardinalby/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
releaseName: ${{ env.Z3_VERSION }}
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Compress built z3.
shell: python
id: compress_z3
working-directory: ${{ github.workspace }}
run: |
# Collect and compress.
from shutil import make_archive, copyfile
from os import mkdir, listdir, environ
from pathlib import Path
from json import loads


def main():
FROM = Path(r"${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}")
TO = Path(r"${{ github.workspace }}/${{ matrix.vcpkg_triplet }}")
LIB = Path(r"${{ matrix.lib }}")

print("`include` dir:", listdir(FROM / "include"))
print("`lib` dir:", listdir(FROM / "lib"))
mkdir(TO)
copyfile(FROM / "lib" / LIB, TO / LIB)
for header in listdir(FROM / "include"):
if header.startswith("z3") and header.endswith(".h"):
copyfile(FROM / "include" / header, TO / header)

make_archive(
base_name=r"${{ matrix.vcpkg_triplet }}",
format="gztar",
root_dir=".",
base_dir=r"${{ matrix.vcpkg_triplet }}",
verbose=True,
)
print("workspace:", listdir(r"${{ github.workspace }}"))


main()
- name: Upload files to a GitHub release
uses: svenstaro/[email protected]
with:
file: ${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz
overwrite: true
tag: ${{ env.Z3_VERSION }}


run_clippy:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Z3
run: brew install z3
- name: Run clippy
run: cargo clippy --workspace --all-targets
- uses: actions/checkout@v4
- name: Install Z3
run: brew install z3
- name: Run clippy
run: cargo clippy --workspace --all-targets
3 changes: 3 additions & 0 deletions z3-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ cmake = { version = "0.1.49", optional = true }
vcpkg = { version = "0.2.15", optional = true }

[features]
# If you set neither features below,
# we hope there is a z3 installed as a system library.

bundled = ["dep:cmake"] # Build Z3 via our bundled submodule.
vcpkg = ["dep:vcpkg"] # Build Z3 via vcpkg.

Expand Down
1 change: 1 addition & 0 deletions z3-sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ There are 3 ways for this crate to currently find Z3:
* Enabling the `vcpkg` feature will cause the copy of `z3.h` provided
by that version to be used. In this case, there is no override
via the environment variable.
Please note that [vcpkg-rs](https://docs.rs/vcpkg-rs) uses `*-windows-static-md` on Windows platform by default.

## Support and Maintenance

Expand Down
1 change: 1 addition & 0 deletions z3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ There are 3 ways for this crate to currently find Z3:
submodule within the repository.
* Enabling the `vcpkg` feature will use `vcpkg` to build and
install a copy of Z3 which is then used.
Please note that [vcpkg-rs](https://docs.rs/vcpkg-rs) uses `*-windows-static-md` on Windows platform by default.

This might look like:

Expand Down
Loading