From 163f80c114d80e75b9cd9a87d1d36756678d3fa6 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 13 Oct 2023 14:34:02 +0800 Subject: [PATCH 01/56] Add basic support for vcpkg. Use vcpkg-rs to manage z3 instead. A non-default feature vcpkg is added. However, vcpkg-rs does not support wasm32 target currently. I created a pull request there at https://github.com/mcgoo/vcpkg-rs/pull/53 --- z3-sys/Cargo.toml | 2 ++ z3-sys/build.rs | 28 ++++++++++++++++++++++++++++ z3/Cargo.toml | 2 ++ 3 files changed, 32 insertions(+) diff --git a/z3-sys/Cargo.toml b/z3-sys/Cargo.toml index bb2ec14b..495e0334 100644 --- a/z3-sys/Cargo.toml +++ b/z3-sys/Cargo.toml @@ -18,8 +18,10 @@ repository = "https://github.com/prove-rs/z3.rs.git" [build-dependencies] bindgen = { version = "0.66.0", default-features = false, features = ["runtime"] } cmake = { version = "0.1.49", optional = true } +vcpkg = { version = "0.2.15", optional = true } [features] # Enable this feature to statically link our own build of Z3, rather than # dynamically linking to the system's `libz3.so`. static-link-z3 = ["cmake"] +vcpkg = ["dep:vcpkg"] diff --git a/z3-sys/build.rs b/z3-sys/build.rs index 010c1aeb..74e1d45c 100644 --- a/z3-sys/build.rs +++ b/z3-sys/build.rs @@ -2,6 +2,7 @@ use std::env; const Z3_HEADER_VAR: &str = "Z3_SYS_Z3_HEADER"; +#[cfg(not(feature = "vcpkg"))] fn main() { #[cfg(feature = "static-link-z3")] build_z3(); @@ -17,6 +18,33 @@ fn main() { }; println!("cargo:rerun-if-env-changed={}", Z3_HEADER_VAR); println!("cargo:rerun-if-changed={}", header); + + generate_binding(&header); +} + +#[cfg(feature = "vcpkg")] +fn main() { + let lib = vcpkg::Config::new() + .emit_includes(true) + .find_package("z3") + .unwrap(); + let found_header = lib.include_paths.iter().any(|include| { + let mut include = include.clone(); + include.push("z3.h"); + if include.exists() { + generate_binding(include.to_str().unwrap()); + true + } else { + false + } + }); + assert!( + found_header, + "z3.h is not found in include path of installed z3." + ); +} + +fn generate_binding(header: &str) { let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()); for x in &[ diff --git a/z3/Cargo.toml b/z3/Cargo.toml index 483ed66f..11c3c7a3 100644 --- a/z3/Cargo.toml +++ b/z3/Cargo.toml @@ -21,6 +21,8 @@ arbitrary-size-numeral = ["num"] # dynamically linking to the system's `libz3.so`. static-link-z3 = ["z3-sys/static-link-z3"] +vcpkg = ["z3-sys/vcpkg"] + [dependencies] log = "0.4" From 0df54a2b5842ec386bed0ebb6ee41e81d02fd803 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 13 Oct 2023 14:34:22 +0800 Subject: [PATCH 02/56] Improve support for wasm32. Make emscripten visible to wasm32-unknown-unknown if emscripten is installed. --- z3-sys/build.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/z3-sys/build.rs b/z3-sys/build.rs index 74e1d45c..3e467ef7 100644 --- a/z3-sys/build.rs +++ b/z3-sys/build.rs @@ -59,16 +59,26 @@ fn generate_binding(header: &str) { "symbol_kind", ] { let mut enum_bindings = bindgen::Builder::default() - .header(&header) + .header(header) .parse_callbacks(Box::new(bindgen::CargoCallbacks)) .generate_comments(false) .rustified_enum(format!("Z3_{}", x)) .allowlist_type(format!("Z3_{}", x)); - if env::var("TARGET").unwrap() == "wasm32-unknown-emscripten" { - enum_bindings = enum_bindings.clang_arg(format!( - "--sysroot={}/upstream/emscripten/cache/sysroot", - env::var("EMSDK").expect("$EMSDK env var missing. Is emscripten installed?") - )); + let target = env::var("TARGET").unwrap(); + let wasm32 = target.starts_with("wasm32-unknown"); + let wasm32_emscripten = target == "wasm32-unknown-emscripten"; + if wasm32 { + let sysroot = env::var("EMSDK") + .map(|emsdk| format!("{}/upstream/emscripten/cache/sysroot", emsdk)) + .or_else(|_err| { + env::var("EMSCRIPTEN_ROOT") + .map(|emscripten_root| format!("{}/cache/sysroot", emscripten_root)) + }); + if let Ok(sysroot) = sysroot { + enum_bindings = enum_bindings.clang_arg(format!("--sysroot={}", sysroot)); + } else if wasm32_emscripten { + panic!("$EMSDK and $EMSCRIPTEN_ROOT env var missing. Is emscripten installed?"); + } } enum_bindings .generate() From 0b302511353a156e62deecbdf736924ef984591d Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 13 Oct 2023 15:42:03 +0800 Subject: [PATCH 03/56] Fix a warning. Z3_HEADER_VAR will disappear when the feature vcpkg is enabled. --- z3-sys/build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/z3-sys/build.rs b/z3-sys/build.rs index 3e467ef7..64c20650 100644 --- a/z3-sys/build.rs +++ b/z3-sys/build.rs @@ -1,5 +1,6 @@ use std::env; +#[cfg(not(feature = "vcpkg"))] const Z3_HEADER_VAR: &str = "Z3_SYS_Z3_HEADER"; #[cfg(not(feature = "vcpkg"))] From 651f28cfac3b4a5e21072980b37292801dfc01de Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 13 Oct 2023 15:50:01 +0800 Subject: [PATCH 04/56] Make clippy happy Use is_err instead of pattern matching. --- z3/tests/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/z3/tests/lib.rs b/z3/tests/lib.rs index 7efaea45..3028a3e9 100644 --- a/z3/tests/lib.rs +++ b/z3/tests/lib.rs @@ -1221,7 +1221,7 @@ fn test_tactic_fail() { let tactic = Tactic::new(&ctx, "fail"); let apply_results = tactic.apply(&goal, Some(¶ms)); - assert!(matches!(apply_results, Err(_))); + assert!(apply_results.is_err()); } #[test] From 2d8d63f14b5362f68756c5c40e9b10b7bf1b5b28 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Wed, 18 Oct 2023 16:38:46 +0800 Subject: [PATCH 05/56] Refactor the process. Added missing cargo:rerun-if-changed for header. --- z3-sys/build.rs | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/z3-sys/build.rs b/z3-sys/build.rs index 64c20650..5fd8fc9a 100644 --- a/z3-sys/build.rs +++ b/z3-sys/build.rs @@ -3,46 +3,51 @@ use std::env; #[cfg(not(feature = "vcpkg"))] const Z3_HEADER_VAR: &str = "Z3_SYS_Z3_HEADER"; -#[cfg(not(feature = "vcpkg"))] fn main() { + #[cfg(not(feature = "vcpkg"))] #[cfg(feature = "static-link-z3")] build_z3(); println!("cargo:rerun-if-changed=build.rs"); - let header = if cfg!(feature = "static-link-z3") { - "z3/src/api/z3.h".to_string() - } else if let Ok(header_path) = std::env::var(Z3_HEADER_VAR) { - header_path - } else { - "wrapper.h".to_string() - }; - println!("cargo:rerun-if-env-changed={}", Z3_HEADER_VAR); - println!("cargo:rerun-if-changed={}", header); + #[cfg(not(feature = "vcpkg"))] + let header = find_header_by_env(); + #[cfg(feature = "vcpkg")] + let header = find_library_header_by_vcpkg(); generate_binding(&header); } #[cfg(feature = "vcpkg")] -fn main() { +fn find_library_header_by_vcpkg() -> String { let lib = vcpkg::Config::new() .emit_includes(true) .find_package("z3") .unwrap(); - let found_header = lib.include_paths.iter().any(|include| { + for include in lib.include_paths.iter() { let mut include = include.clone(); include.push("z3.h"); if include.exists() { - generate_binding(include.to_str().unwrap()); - true - } else { - false + let header = include.to_str().unwrap().to_owned(); + println!("cargo:rerun-if-changed={}", header); + return header; } - }); - assert!( - found_header, - "z3.h is not found in include path of installed z3." - ); + } + panic!("z3.h is not found in include path of installed z3."); +} + +#[cfg(not(feature = "vcpkg"))] +fn find_header_by_env() -> String { + let header = if cfg!(feature = "static-link-z3") { + "z3/src/api/z3.h".to_string() + } else if let Ok(header_path) = std::env::var(Z3_HEADER_VAR) { + header_path + } else { + "wrapper.h".to_string() + }; + println!("cargo:rerun-if-env-changed={}", Z3_HEADER_VAR); + println!("cargo:rerun-if-changed={}", header); + header } fn generate_binding(header: &str) { From 02de1e72ca31d112399a4efd16f443b0beda9cfa Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Wed, 18 Oct 2023 16:39:27 +0800 Subject: [PATCH 06/56] Added a ci test for vcpkg-installed z3 --- .github/workflows/rust.yml | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7b3aee31..b2160c3d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -94,6 +94,46 @@ jobs: run: cargo test -vv --features static-link-z3 - name: Test `z3` with statically linked Z3 and `arbitrary-size-numeral` enabled run: cargo test --manifest-path z3/Cargo.toml -vv --features 'static-link-z3 arbitrary-size-numeral' + build_with_vcpkg_installed_z3: + strategy: + matrix: + build: [linux, macos, windows] + include: + - os: ubuntu-latest + vcpkg_triplet: x64-linux + - os: macos-latest + vcpkg_triplet: x64-osx + - os: windows-latest + vcpkg_triplet: x64-windows-static-md + 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: matrix.os == 'windows-latest' + with: + version: "11.0" + directory: ${{ runner.temp }}/llvm + - name: Set LIBCLANG_PATH + run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV + if: matrix.os == 'windows-latest' + - name: vcpkg build z3 + uses: johnwason/vcpkg-action@v5 + id: vcpkg + with: + pkgs: boost-date-time + triplet: ${{ matrix.config.vcpkg_triplet }} + cache-key: ${{ matrix.config.os }} + revision: master + token: ${{ github.token }} + - name: Build `z3-sys` and `z3` with vcpkg installed Z3 + run: cargo build -vv --features vcpkg + - name: Test `z3-sys` and `z3` with vcpkg installed Z3 + run: cargo test -vv --features vcpkg + - name: Test `z3` with vcpkg installed Z3 and `arbitrary-size-numeral` enabled + run: cargo test --manifest-path z3/Cargo.toml -vv --features 'vcpkg arbitrary-size-numeral' run_clippy: runs-on: ubuntu-latest From 771665005232f9b4f2e58102eaa54b0e1d915dd8 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Wed, 18 Oct 2023 16:45:44 +0800 Subject: [PATCH 07/56] Fix mistakes in ci --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b2160c3d..a6e5a4f8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -98,7 +98,7 @@ jobs: strategy: matrix: build: [linux, macos, windows] - include: + config: - os: ubuntu-latest vcpkg_triplet: x64-linux - os: macos-latest @@ -123,7 +123,7 @@ jobs: uses: johnwason/vcpkg-action@v5 id: vcpkg with: - pkgs: boost-date-time + pkgs: z3 triplet: ${{ matrix.config.vcpkg_triplet }} cache-key: ${{ matrix.config.os }} revision: master From ed6b65bce633ed6b229951cf27b3de34d05dbcee Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Wed, 18 Oct 2023 17:17:35 +0800 Subject: [PATCH 08/56] Rename build_z3 to build_bundled_z3 --- z3-sys/build.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/z3-sys/build.rs b/z3-sys/build.rs index 5fd8fc9a..d91f1bea 100644 --- a/z3-sys/build.rs +++ b/z3-sys/build.rs @@ -4,9 +4,11 @@ use std::env; const Z3_HEADER_VAR: &str = "Z3_SYS_Z3_HEADER"; fn main() { + // Feature `vcpkg` is prior to `static-link-z3` as vcpkg-installed z3 is also statically linked. + #[cfg(not(feature = "vcpkg"))] #[cfg(feature = "static-link-z3")] - build_z3(); + build_bundled_z3(); println!("cargo:rerun-if-changed=build.rs"); @@ -94,8 +96,10 @@ fn generate_binding(header: &str) { } } +/// Build z3 with bundled source codes. +#[cfg(not(feature = "vcpkg"))] #[cfg(feature = "static-link-z3")] -fn build_z3() { +fn build_bundled_z3() { let mut cfg = cmake::Config::new("z3"); cfg // Don't build `libz3.so`, build `libz3.a` instead. From 728b962eb5bad61b2d8f506c2c23a86b163eca92 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Wed, 18 Oct 2023 17:18:03 +0800 Subject: [PATCH 09/56] Revert "Improve support for wasm32." This reverts commit 0df54a2b5842ec386bed0ebb6ee41e81d02fd803. --- z3-sys/build.rs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/z3-sys/build.rs b/z3-sys/build.rs index d91f1bea..8208cbec 100644 --- a/z3-sys/build.rs +++ b/z3-sys/build.rs @@ -67,26 +67,16 @@ fn generate_binding(header: &str) { "symbol_kind", ] { let mut enum_bindings = bindgen::Builder::default() - .header(header) + .header(&header) .parse_callbacks(Box::new(bindgen::CargoCallbacks)) .generate_comments(false) .rustified_enum(format!("Z3_{}", x)) .allowlist_type(format!("Z3_{}", x)); - let target = env::var("TARGET").unwrap(); - let wasm32 = target.starts_with("wasm32-unknown"); - let wasm32_emscripten = target == "wasm32-unknown-emscripten"; - if wasm32 { - let sysroot = env::var("EMSDK") - .map(|emsdk| format!("{}/upstream/emscripten/cache/sysroot", emsdk)) - .or_else(|_err| { - env::var("EMSCRIPTEN_ROOT") - .map(|emscripten_root| format!("{}/cache/sysroot", emscripten_root)) - }); - if let Ok(sysroot) = sysroot { - enum_bindings = enum_bindings.clang_arg(format!("--sysroot={}", sysroot)); - } else if wasm32_emscripten { - panic!("$EMSDK and $EMSCRIPTEN_ROOT env var missing. Is emscripten installed?"); - } + if env::var("TARGET").unwrap() == "wasm32-unknown-emscripten" { + enum_bindings = enum_bindings.clang_arg(format!( + "--sysroot={}/upstream/emscripten/cache/sysroot", + env::var("EMSDK").expect("$EMSDK env var missing. Is emscripten installed?") + )); } enum_bindings .generate() From d4d3164edc2c768a3bd4f7031d799e4c0dae0060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Wed, 18 Oct 2023 18:14:07 +0800 Subject: [PATCH 10/56] Fix an error in build script. --- z3-sys/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/z3-sys/build.rs b/z3-sys/build.rs index 8208cbec..1614a9bb 100644 --- a/z3-sys/build.rs +++ b/z3-sys/build.rs @@ -67,7 +67,7 @@ fn generate_binding(header: &str) { "symbol_kind", ] { let mut enum_bindings = bindgen::Builder::default() - .header(&header) + .header(header) .parse_callbacks(Box::new(bindgen::CargoCallbacks)) .generate_comments(false) .rustified_enum(format!("Z3_{}", x)) From a31eb7f83b262d7eab5d25f0962c7f1efdf5a5f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Wed, 18 Oct 2023 19:08:24 +0800 Subject: [PATCH 11/56] Fix an error in ci --- .github/workflows/rust.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a6e5a4f8..ef84ff2d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -98,7 +98,7 @@ jobs: strategy: matrix: build: [linux, macos, windows] - config: + include: - os: ubuntu-latest vcpkg_triplet: x64-linux - os: macos-latest @@ -124,8 +124,8 @@ jobs: id: vcpkg with: pkgs: z3 - triplet: ${{ matrix.config.vcpkg_triplet }} - cache-key: ${{ matrix.config.os }} + triplet: ${{ matrix.vcpkg_triplet }} + cache-key: ${{ matrix.os }} revision: master token: ${{ github.token }} - name: Build `z3-sys` and `z3` with vcpkg installed Z3 From 9f0bd1d38e118406e398ccda520ca10b377edf57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Wed, 18 Oct 2023 20:11:19 +0800 Subject: [PATCH 12/56] Fixing ci errors. --- .github/workflows/rust.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ef84ff2d..4e2dbf90 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -99,11 +99,14 @@ jobs: matrix: build: [linux, macos, windows] include: - - os: ubuntu-latest + - build: linux + os: ubuntu-latest vcpkg_triplet: x64-linux - - os: macos-latest + - build: macos + os: macos-latest vcpkg_triplet: x64-osx - - os: windows-latest + - build: windows + os: windows-latest vcpkg_triplet: x64-windows-static-md runs-on: ${{ matrix.os }} steps: @@ -119,6 +122,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 }}. - name: vcpkg build z3 uses: johnwason/vcpkg-action@v5 id: vcpkg @@ -128,6 +132,7 @@ jobs: cache-key: ${{ matrix.os }} revision: master token: ${{ github.token }} + - run: export VCPKG_ROOT=${{ github.workspace }}/vcpkg - name: Build `z3-sys` and `z3` with vcpkg installed Z3 run: cargo build -vv --features vcpkg - name: Test `z3-sys` and `z3` with vcpkg installed Z3 From a5b44da5a1487c07030b1b90cbd87fc9cc01f287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Wed, 18 Oct 2023 20:54:03 +0800 Subject: [PATCH 13/56] Force to set VCPKG_ROOT in CI --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4e2dbf90..a34d280c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -109,6 +109,8 @@ jobs: os: windows-latest vcpkg_triplet: x64-windows-static-md runs-on: ${{ matrix.os }} + env: + VCPKG_ROOT: ${{ github.workspace }}/vcpkg steps: - uses: actions/checkout@v3 with: From ecb607bdee64290195323ac3666984ae2f5a9242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Wed, 18 Oct 2023 21:02:21 +0800 Subject: [PATCH 14/56] Remove macos and a redundant step from workflows --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a34d280c..c12c9106 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -102,9 +102,10 @@ jobs: - build: linux os: ubuntu-latest vcpkg_triplet: x64-linux - - build: macos - os: macos-latest - vcpkg_triplet: x64-osx + # It fails on macos. + # - build: macos + # os: macos-latest + # vcpkg_triplet: x64-osx - build: windows os: windows-latest vcpkg_triplet: x64-windows-static-md @@ -134,7 +135,6 @@ jobs: cache-key: ${{ matrix.os }} revision: master token: ${{ github.token }} - - run: export VCPKG_ROOT=${{ github.workspace }}/vcpkg - name: Build `z3-sys` and `z3` with vcpkg installed Z3 run: cargo build -vv --features vcpkg - name: Test `z3-sys` and `z3` with vcpkg installed Z3 From 63aa222fb8d6d76046661fc27609c1d703560190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Wed, 18 Oct 2023 21:08:20 +0800 Subject: [PATCH 15/56] No fail fast --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c12c9106..a5867f50 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -96,16 +96,16 @@ jobs: run: cargo test --manifest-path z3/Cargo.toml -vv --features 'static-link-z3 arbitrary-size-numeral' build_with_vcpkg_installed_z3: strategy: + fail-fast: false matrix: build: [linux, macos, windows] include: - build: linux os: ubuntu-latest vcpkg_triplet: x64-linux - # It fails on macos. - # - build: macos - # os: macos-latest - # vcpkg_triplet: x64-osx + - build: macos + os: macos-latest + vcpkg_triplet: x64-osx - build: windows os: windows-latest vcpkg_triplet: x64-windows-static-md From 6c0f856d7c0bf7275a83fca081b6cc864366cda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Thu, 19 Oct 2023 00:56:02 +0800 Subject: [PATCH 16/56] Test on windows only. --- .github/workflows/rust.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a5867f50..cccef9b3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -96,9 +96,8 @@ jobs: run: cargo test --manifest-path z3/Cargo.toml -vv --features 'static-link-z3 arbitrary-size-numeral' build_with_vcpkg_installed_z3: strategy: - fail-fast: false matrix: - build: [linux, macos, windows] + build: [windows] include: - build: linux os: ubuntu-latest From 25a913e28c3a4a383b3417cf6106a584cda45a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Thu, 19 Oct 2023 00:56:27 +0800 Subject: [PATCH 17/56] Clean build trees after build. So that rust can continue to build. --- .github/workflows/rust.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index cccef9b3..be023dc3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -134,6 +134,7 @@ jobs: cache-key: ${{ matrix.os }} revision: master token: ${{ github.token }} + extra-args: --clean-buildtrees-after-build - name: Build `z3-sys` and `z3` with vcpkg installed Z3 run: cargo build -vv --features vcpkg - name: Test `z3-sys` and `z3` with vcpkg installed Z3 From e5244a661d59d3ad8fcef49e7fb70f3bdf5f3ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Thu, 19 Oct 2023 01:01:02 +0800 Subject: [PATCH 18/56] Test only on Windows indeed. --- .github/workflows/rust.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index be023dc3..173d21bb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -97,14 +97,14 @@ jobs: build_with_vcpkg_installed_z3: strategy: matrix: - build: [windows] + build: [windows] # [linux, macos, windows] include: - - build: linux - os: ubuntu-latest - vcpkg_triplet: x64-linux - - build: macos - os: macos-latest - vcpkg_triplet: x64-osx + # - build: linux + # os: ubuntu-latest + # vcpkg_triplet: x64-linux + # - build: macos + # os: macos-latest + # vcpkg_triplet: x64-osx - build: windows os: windows-latest vcpkg_triplet: x64-windows-static-md From bfb6a461a6022fd23b77ed6af7b243b7d3468c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Thu, 19 Oct 2023 01:01:50 +0800 Subject: [PATCH 19/56] Show default toolchain of rust. By this, we can check whether the toolchain matches the vcpkg triplet. --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 173d21bb..41902c25 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -135,6 +135,8 @@ jobs: revision: master token: ${{ github.token }} extra-args: --clean-buildtrees-after-build + - name: Show default toolchain of rust. + run: rustup default - name: Build `z3-sys` and `z3` with vcpkg installed Z3 run: cargo build -vv --features vcpkg - name: Test `z3-sys` and `z3` with vcpkg installed Z3 From 954a72fbb349bdb717f41664b9e621685d50a08c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Thu, 19 Oct 2023 01:20:29 +0800 Subject: [PATCH 20/56] CI: Update to `actions/checkout@v4`. --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 387a48f9..df42342c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,7 +15,7 @@ jobs: check-formatting: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check formatting run: cargo fmt -- --check @@ -112,7 +112,7 @@ jobs: env: VCPKG_ROOT: ${{ github.workspace }}/vcpkg steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive - name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797 From 8094dbf428a4e6bcb3302dc9e8e514880d09e8bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Thu, 19 Oct 2023 01:25:05 +0800 Subject: [PATCH 21/56] CI: Avoid redundant line breaking and spaces. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index df42342c..cf42f4e2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -124,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 From 73a27e46d00617c4f3805e091d5ac5eb105bfc0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Thu, 19 Oct 2023 01:40:18 +0800 Subject: [PATCH 22/56] Update documentation about feature `vcpkg` --- z3-sys/Cargo.toml | 3 +++ z3-sys/README.md | 2 ++ z3/Cargo.toml | 3 +++ 3 files changed, 8 insertions(+) diff --git a/z3-sys/Cargo.toml b/z3-sys/Cargo.toml index 495e0334..89ded7f2 100644 --- a/z3-sys/Cargo.toml +++ b/z3-sys/Cargo.toml @@ -24,4 +24,7 @@ vcpkg = { version = "0.2.15", optional = true } # Enable this feature to statically link our own build of Z3, rather than # dynamically linking to the system's `libz3.so`. static-link-z3 = ["cmake"] + +# Enable this feature to use z3 that is built with vcpkg. +# Note that by default vcpkg-rs uses *-windows-static-md triplet on Windows. vcpkg = ["dep:vcpkg"] diff --git a/z3-sys/README.md b/z3-sys/README.md index 8b85da33..5755abb6 100644 --- a/z3-sys/README.md +++ b/z3-sys/README.md @@ -28,6 +28,8 @@ z3-sys = "0.8" * By default, the crate will look for a `z3.h` in standard/system include paths. * If the feature `static-link-z3` is enabled, the `z3.h` of the built Z3 will be used. +* If the feature `vcpkg` is enabled, the `z3.h` of the built Z3 in vcpkg will be used. + Please note that [vcpkg-rs](https://docs.rs/vcpkg-rs) uses `*-windows-static-md` on Windows platform by default. * Alternatively, the path to the desired `z3.h` can be specified via the environment variable `Z3_SYS_Z3_HEADER`. I.e., running: diff --git a/z3/Cargo.toml b/z3/Cargo.toml index 11c3c7a3..472a0213 100644 --- a/z3/Cargo.toml +++ b/z3/Cargo.toml @@ -21,6 +21,9 @@ arbitrary-size-numeral = ["num"] # dynamically linking to the system's `libz3.so`. static-link-z3 = ["z3-sys/static-link-z3"] + +# Enable this feature to use z3 that is built with vcpkg. +# Note that by default vcpkg-rs uses *-windows-static-md triplet on Windows. vcpkg = ["z3-sys/vcpkg"] [dependencies] From c4c417d24421dee23484e42cae9f572d07879df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Fri, 20 Oct 2023 23:27:26 +0800 Subject: [PATCH 23/56] Change `statically linked` to `bundled`. --- .github/workflows/rust.yml | 22 +++++++++++----------- z3-sys/Cargo.toml | 8 +++++--- z3-sys/README.md | 2 +- z3-sys/build.rs | 10 ++++++---- z3/Cargo.toml | 7 ++++--- z3/README.md | 4 ++-- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index cf42f4e2..e771a005 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -30,7 +30,7 @@ jobs: # 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 - # statically-linked Z3 tests below... + # bundled Z3 tests below... if: ${{ success() || failure() }} - name: Run tests run: cargo test -vv --all @@ -58,12 +58,12 @@ jobs: 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 + - name: Build z3-sys and z3 with bundled Z3 run: | source ~/emsdk/emsdk_env.sh - cargo build --target=wasm32-unknown-emscripten -vv --features static-link-z3 + cargo build --target=wasm32-unknown-emscripten -vv --features bundled-z3 - build_z3_statically: + build_bundled_z3: strategy: matrix: build: [linux, macos, windows] @@ -88,12 +88,12 @@ jobs: - name: Set LIBCLANG_PATH run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV if: matrix.os == 'windows-latest' - - name: Build `z3-sys` and `z3` with statically linked Z3 - run: cargo build -vv --features static-link-z3 - - name: Test `z3-sys` and `z3` with statically linked Z3 - run: cargo test -vv --features static-link-z3 - - name: Test `z3` with statically linked Z3 and `arbitrary-size-numeral` enabled - run: cargo test --manifest-path z3/Cargo.toml -vv --features 'static-link-z3 arbitrary-size-numeral' + - name: Build `z3-sys` and `z3` with bundled Z3 + run: cargo build -vv --features bundled-z3 + - name: Test `z3-sys` and `z3` with bundled Z3 + run: cargo test -vv --features bundled-z3 + - name: Test `z3` with bundled Z3 and `arbitrary-size-numeral` enabled + run: cargo test --manifest-path z3/Cargo.toml -vv --features 'bundled-z3 arbitrary-size-numeral' build_with_vcpkg_installed_z3: strategy: matrix: @@ -151,4 +151,4 @@ jobs: with: submodules: recursive - name: Run clippy - run: cargo clippy -vv --features static-link-z3 --all-targets \ No newline at end of file + run: cargo clippy -vv --features bundled-z3 --all-targets \ No newline at end of file diff --git a/z3-sys/Cargo.toml b/z3-sys/Cargo.toml index 89ded7f2..97c95661 100644 --- a/z3-sys/Cargo.toml +++ b/z3-sys/Cargo.toml @@ -21,9 +21,11 @@ cmake = { version = "0.1.49", optional = true } vcpkg = { version = "0.2.15", optional = true } [features] -# Enable this feature to statically link our own build of Z3, rather than -# dynamically linking to the system's `libz3.so`. -static-link-z3 = ["cmake"] +# If you set neither features below, +# we hope there is a z3 installed as a system library. + +# Enable this feature to build bundled Z3 in z3-sys. +bundled-z3 = ["cmake"] # Enable this feature to use z3 that is built with vcpkg. # Note that by default vcpkg-rs uses *-windows-static-md triplet on Windows. diff --git a/z3-sys/README.md b/z3-sys/README.md index 5755abb6..67d9335a 100644 --- a/z3-sys/README.md +++ b/z3-sys/README.md @@ -27,7 +27,7 @@ z3-sys = "0.8" **Note:** This crate requires a `z3.h` during build time. * By default, the crate will look for a `z3.h` in standard/system include paths. -* If the feature `static-link-z3` is enabled, the `z3.h` of the built Z3 will be used. +* If the feature `bundled-z3` is enabled, the `z3.h` of the built Z3 will be used. * If the feature `vcpkg` is enabled, the `z3.h` of the built Z3 in vcpkg will be used. Please note that [vcpkg-rs](https://docs.rs/vcpkg-rs) uses `*-windows-static-md` on Windows platform by default. * Alternatively, the path to the desired `z3.h` can be specified via the environment variable diff --git a/z3-sys/build.rs b/z3-sys/build.rs index 1614a9bb..9f0dc65f 100644 --- a/z3-sys/build.rs +++ b/z3-sys/build.rs @@ -4,10 +4,12 @@ use std::env; const Z3_HEADER_VAR: &str = "Z3_SYS_Z3_HEADER"; fn main() { - // Feature `vcpkg` is prior to `static-link-z3` as vcpkg-installed z3 is also statically linked. + #[cfg(feature = "vcpkg")] + #[cfg(feature = "bundled-z3")] + panic!("Feature `vcpkg` conflicts with `bundled-z3`."); #[cfg(not(feature = "vcpkg"))] - #[cfg(feature = "static-link-z3")] + #[cfg(feature = "bundled-z3")] build_bundled_z3(); println!("cargo:rerun-if-changed=build.rs"); @@ -40,7 +42,7 @@ fn find_library_header_by_vcpkg() -> String { #[cfg(not(feature = "vcpkg"))] fn find_header_by_env() -> String { - let header = if cfg!(feature = "static-link-z3") { + let header = if cfg!(feature = "bundled-z3") { "z3/src/api/z3.h".to_string() } else if let Ok(header_path) = std::env::var(Z3_HEADER_VAR) { header_path @@ -88,7 +90,7 @@ fn generate_binding(header: &str) { /// Build z3 with bundled source codes. #[cfg(not(feature = "vcpkg"))] -#[cfg(feature = "static-link-z3")] +#[cfg(feature = "bundled-z3")] fn build_bundled_z3() { let mut cfg = cmake::Config::new("z3"); cfg diff --git a/z3/Cargo.toml b/z3/Cargo.toml index 472a0213..4a024429 100644 --- a/z3/Cargo.toml +++ b/z3/Cargo.toml @@ -17,10 +17,11 @@ repository = "https://github.com/prove-rs/z3.rs.git" default = [] arbitrary-size-numeral = ["num"] -# Enable this feature to statically link our own build of Z3, rather than -# dynamically linking to the system's `libz3.so`. -static-link-z3 = ["z3-sys/static-link-z3"] +# If you set neither features below, +# we hope there is a z3 installed as a system library. +# Enable this feature to build bundled Z3 in z3-sys. +bundled-z3 = ["z3-sys/bundled-z3"] # Enable this feature to use z3 that is built with vcpkg. # Note that by default vcpkg-rs uses *-windows-static-md triplet on Windows. diff --git a/z3/README.md b/z3/README.md index 549faaae..4cf2e6dc 100644 --- a/z3/README.md +++ b/z3/README.md @@ -26,11 +26,11 @@ z3 = "0.12" **Note:** This library has a dependency on Z3. You will either need to have the Z3 dependency already installed, or you can statically link -to our build of Z3 like so: +to the build of our bundled Z3 like so: ```toml [dependencies] -z3 = {version="0.12", features = ["static-link-z3"]} +z3 = {version="0.12", features = ["bundled-z3"]} ``` ## Support and Maintenance From c1e7eaa5bdbee323032a871aba770c71fd1903aa Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Thu, 26 Oct 2023 19:44:39 +0800 Subject: [PATCH 24/56] Try compressing z3 library --- .github/workflows/prebuild.yml | 83 ++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .github/workflows/prebuild.yml diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml new file mode 100644 index 00000000..1548936d --- /dev/null +++ b/.github/workflows/prebuild.yml @@ -0,0 +1,83 @@ +on: + push: + branches: [ upload-prebuilt-static-z3 ] +jobs: + release: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + upload_vcpkg_installed_z3: + strategy: + matrix: + build: [linux, macos, windows] + include: + - build: linux + os: ubuntu-latest + vcpkg_triplet: x64-linux + - build: macos + os: macos-latest + vcpkg_triplet: x64-osx + - build: windows + os: windows-latest + vcpkg_triplet: x64-windows-static-md + runs-on: ${{ matrix.os }} + env: + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - run: echo "Instaling z3:${{ matrix.vcpkg_triplet }} on ${{ matrix.os }}." + - name: vcpkg build z3 + uses: johnwason/vcpkg-action@v5 + id: vcpkg + with: + pkgs: z3 + triplet: ${{ matrix.vcpkg_triplet }} + cache-key: ${{ matrix.os }} + revision: master + token: ${{ github.token }} + extra-args: --clean-buildtrees-after-build + - name: list + run: | + ls ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib + ls ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include + - name: compress + run: | + mkdir ${{ github.workspace }}/tmp + headers = ("z3.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") + for file in $headers + do + cp ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/$file ${{ github.workspace }}/pack/$file + done + cp ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib/libz3.a ${{ github.workspace }}/pack/libz3.a + tar -jcvf ${{ github.workspace }}/pack.tar.gz ${{ github.workspace }}/pack + # - name: release + # uses: actions/create-release@v1 + # id: create_release + # with: + # draft: false + # prerelease: false + # release_name: ${{ github.ref }} + # tag_name: ${{ github.ref }} + # env: + # GITHUB_TOKEN: ${{ github.token }} + # - name: upload artifact + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ github.token }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_path: ${{ github.workspace }} + # asset_name: pack.tar.gz + # asset_content_type: application/gzip From 77c82679616aa35f9cf8481452d2d6cbe5fbda43 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Thu, 26 Oct 2023 20:24:56 +0800 Subject: [PATCH 25/56] Fix an error in CI --- .github/workflows/prebuild.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 1548936d..3c171378 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -18,6 +18,7 @@ jobs: prerelease: false upload_vcpkg_installed_z3: strategy: + fail-fast: false matrix: build: [linux, macos, windows] include: @@ -55,7 +56,7 @@ jobs: - name: compress run: | mkdir ${{ github.workspace }}/tmp - headers = ("z3.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") + headers=("z3.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") for file in $headers do cp ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/$file ${{ github.workspace }}/pack/$file From 25c624b1896f87ef91ff8f6b7bf0e2613aab988c Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Thu, 26 Oct 2023 21:43:47 +0800 Subject: [PATCH 26/56] Fix some errors in CI --- .github/workflows/prebuild.yml | 37 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 3c171378..d2d491fe 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -2,20 +2,20 @@ on: push: branches: [ upload-prebuilt-static-z3 ] jobs: - release: - name: Create Release - runs-on: ubuntu-latest - steps: - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: false + # release: + # name: Create Release + # runs-on: ubuntu-latest + # steps: + # - name: Create Release + # id: create_release + # uses: actions/create-release@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: ${{ github.ref }} + # release_name: ${{ github.ref }} + # draft: false + # prerelease: false upload_vcpkg_installed_z3: strategy: fail-fast: false @@ -25,12 +25,15 @@ 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 @@ -46,7 +49,7 @@ jobs: pkgs: z3 triplet: ${{ matrix.vcpkg_triplet }} cache-key: ${{ matrix.os }} - revision: master + revision: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 token: ${{ github.token }} extra-args: --clean-buildtrees-after-build - name: list @@ -55,13 +58,13 @@ jobs: ls ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include - name: compress run: | - mkdir ${{ github.workspace }}/tmp + mkdir ${{ github.workspace }}/pack headers=("z3.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") for file in $headers do cp ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/$file ${{ github.workspace }}/pack/$file done - cp ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib/libz3.a ${{ github.workspace }}/pack/libz3.a + cp ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib/${{ matrix.lib }} ${{ github.workspace }}/pack/${{ matrix.lib }} tar -jcvf ${{ github.workspace }}/pack.tar.gz ${{ github.workspace }}/pack # - name: release # uses: actions/create-release@v1 From 5b79ce222c16b6aa2341aff75bcc0d3d9fb0f00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Fri, 27 Oct 2023 00:12:43 +0800 Subject: [PATCH 27/56] A preliminary CI --- .github/workflows/prebuild.yml | 119 +++++++++++++------------------- z3-sys/scripts/make_artifact.sh | 19 +++++ 2 files changed, 68 insertions(+), 70 deletions(-) create mode 100644 z3-sys/scripts/make_artifact.sh diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index d2d491fe..45ce23b1 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -1,87 +1,66 @@ +name: Upload prebuilt Z3 on: push: branches: [ upload-prebuilt-static-z3 ] jobs: - # release: - # name: Create Release - # runs-on: ubuntu-latest - # steps: - # - name: Create Release - # id: create_release - # uses: actions/create-release@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # tag_name: ${{ github.ref }} - # release_name: ${{ github.ref }} - # draft: false - # prerelease: false - upload_vcpkg_installed_z3: - strategy: - fail-fast: false - matrix: - build: [linux, macos, windows] - include: - - 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 }} + release: + name: Create Release + runs-on: ubuntu-latest env: VCPKG_ROOT: ${{ github.workspace }}/vcpkg + VCPKG_REVISION: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false - uses: actions/checkout@v4 with: submodules: recursive - - run: echo "Instaling z3:${{ matrix.vcpkg_triplet }} on ${{ matrix.os }}." - name: vcpkg build z3 uses: johnwason/vcpkg-action@v5 - id: vcpkg with: pkgs: z3 - triplet: ${{ matrix.vcpkg_triplet }} - cache-key: ${{ matrix.os }} - revision: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 + triplet: x64-linux + cache-key: ubuntu-latest + revision: ${{ env.VCPKG_REVISION }} token: ${{ github.token }} extra-args: --clean-buildtrees-after-build - - name: list - run: | - ls ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib - ls ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include - - name: compress + - name: vcpkg build z3 + uses: johnwason/vcpkg-action@v5 + with: + pkgs: z3 + triplet: macos-latest + cache-key: x64-osx + revision: ${{ env.VCPKG_REVISION }} + token: ${{ github.token }} + extra-args: --clean-buildtrees-after-build + - name: vcpkg build z3 + uses: johnwason/vcpkg-action@v5 + with: + pkgs: z3 + triplet: x64-windows-static-md + cache-key: windows-latest + revision: ${{ env.VCPKG_REVISION }} + token: ${{ github.token }} + extra-args: --clean-buildtrees-after-build + - name: prepare artifact run: | - mkdir ${{ github.workspace }}/pack - headers=("z3.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") - for file in $headers - do - cp ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/$file ${{ github.workspace }}/pack/$file - done - cp ${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib/${{ matrix.lib }} ${{ github.workspace }}/pack/${{ matrix.lib }} - tar -jcvf ${{ github.workspace }}/pack.tar.gz ${{ github.workspace }}/pack - # - name: release - # uses: actions/create-release@v1 - # id: create_release - # with: - # draft: false - # prerelease: false - # release_name: ${{ github.ref }} - # tag_name: ${{ github.ref }} - # env: - # GITHUB_TOKEN: ${{ github.token }} - # - name: upload artifact - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: ${{ github.token }} - # with: - # upload_url: ${{ steps.create_release.outputs.upload_url }} - # asset_path: ${{ github.workspace }} - # asset_name: pack.tar.gz - # asset_content_type: application/gzip + sh z3-sys/scripts/make_artifact.sh ${{ github.workspace }} ${{ env.VCPKG_ROOT }} x64-linux libz3.a + sh z3-sys/scripts/make_artifact.sh ${{ github.workspace }} ${{ env.VCPKG_ROOT }} x64-osx libz3.a + sh z3-sys/scripts/make_artifact.sh ${{ github.workspace }} ${{ env.VCPKG_ROOT }} x64-windows-static-md libz3.lib + - name: upload artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/x64-linux.tar.gz + asset_name: x64-linux.tar.gz + asset_content_type: application/gzip diff --git a/z3-sys/scripts/make_artifact.sh b/z3-sys/scripts/make_artifact.sh new file mode 100644 index 00000000..65656b24 --- /dev/null +++ b/z3-sys/scripts/make_artifact.sh @@ -0,0 +1,19 @@ + +WORKSPACE=$1 +VCPKG_ROOT=$2 +VCPKG_TRIPLET=$3 +LIB=$4 + +ls $VCPKG_ROOT/installed/$VCPKG_TRIPLET/lib +ls $VCPKG_ROOT/installed/$VCPKG_TRIPLET/include + +mkdir "$WORKSPACE/$VCPKG_TRIPLET" + +headers=("z3.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") +for i in $headers +do +cp "$VCPKG_ROOT/installed/$VCPKG_TRIPLET/include/$file" "$WORKSPACE/$VCPKG_TRIPLET/$file" +done +cp "$VCPKG_ROOT/installed/$VCPKG_TRIPLET/lib/$LIB" "$WORKSPACE/$VCPKG_TRIPLET/$LIB" + +tar -jcvf "$WORKSPACE/$VCPKG_TRIPLET.tar.gz" "$WORKSPACE/$VCPKG_TRIPLET" \ No newline at end of file From e7ab918288cf567088e6ebc7b02c56b1c0e97dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Fri, 27 Oct 2023 00:22:40 +0800 Subject: [PATCH 28/56] Use a script to generate CI. --- .github/workflows/prebuild.py | 61 ++++++++++++++++++++++++++++++++++ .github/workflows/prebuild.yml | 25 ++++++++++++-- 2 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/prebuild.py diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py new file mode 100644 index 00000000..7a94324d --- /dev/null +++ b/.github/workflows/prebuild.py @@ -0,0 +1,61 @@ +with open("prebuild.yml", "w") as f: + PLATFORM = [ + ["ubuntu-latest", "x64-linux", "libz3.a"], + ["macos-latest", "x64-osx", "libz3.a"], + ["windows-latest", "x64-windows-static-md", "libz3.lib"], + ] + f.write("""\ +name: Upload prebuilt Z3 +on: + push: + branches: [ upload-prebuilt-static-z3 ] +jobs: + release: + name: Create Release + runs-on: ubuntu-latest + env: + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + VCPKG_REVISION: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + - uses: actions/checkout@v4 + with: + submodules: recursive""") + for os, triplet, _ in PLATFORM: + f.write(""" + - name: vcpkg build z3 + uses: johnwason/vcpkg-action@v5 + with: + pkgs: z3 + triplet: """+triplet+""" + cache-key: """+os+""" + revision: ${{ env.VCPKG_REVISION }} + token: ${{ github.token }} + extra-args: --clean-buildtrees-after-build""") + f.write(f""" + - name: prepare artifact + run: |""") + for _, triplet, lib in PLATFORM: + f.write(""" + sh z3-sys/scripts/make_artifact.sh ${{ github.workspace }} ${{ env.VCPKG_ROOT }} """ + f"{triplet} {lib}") + for _, triplet, _ in PLATFORM: + f.write(""" + - name: upload artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/x64-linux.tar.gz + asset_name: x64-linux.tar.gz + asset_content_type: application/gzip + """) \ No newline at end of file diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 45ce23b1..08331b38 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -36,8 +36,8 @@ jobs: uses: johnwason/vcpkg-action@v5 with: pkgs: z3 - triplet: macos-latest - cache-key: x64-osx + triplet: x64-osx + cache-key: macos-latest revision: ${{ env.VCPKG_REVISION }} token: ${{ github.token }} extra-args: --clean-buildtrees-after-build @@ -64,3 +64,24 @@ jobs: asset_path: ${{ github.workspace }}/x64-linux.tar.gz asset_name: x64-linux.tar.gz asset_content_type: application/gzip + + - name: upload artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/x64-linux.tar.gz + asset_name: x64-linux.tar.gz + asset_content_type: application/gzip + + - name: upload artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/x64-linux.tar.gz + asset_name: x64-linux.tar.gz + asset_content_type: application/gzip + \ No newline at end of file From d5a912fcf66d8a7021a7f83da5e35a80ce357577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Fri, 27 Oct 2023 00:26:31 +0800 Subject: [PATCH 29/56] Fix an error in CI about release name --- .github/workflows/prebuild.py | 6 +++--- .github/workflows/prebuild.yml | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py index 7a94324d..d5376e23 100644 --- a/.github/workflows/prebuild.py +++ b/.github/workflows/prebuild.py @@ -13,9 +13,9 @@ release: name: Create Release runs-on: ubuntu-latest - env: VCPKG_ROOT: ${{ github.workspace }}/vcpkg VCPKG_REVISION: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 + Z3_VERSION: 0.12.2 steps: - name: Create Release id: create_release @@ -23,8 +23,8 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} + tag_name: ${{ env.Z3_VERSION }} + release_name: ${{ env.Z3_VERSION }} draft: false prerelease: false - uses: actions/checkout@v4 diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 08331b38..c1f4d011 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -9,6 +9,7 @@ jobs: env: VCPKG_ROOT: ${{ github.workspace }}/vcpkg VCPKG_REVISION: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 + Z3_VERSION: 0.12.2 steps: - name: Create Release id: create_release @@ -16,8 +17,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} + tag_name: ${{ env.Z3_VERSION }} + release_name: ${{ env.Z3_VERSION }} draft: false prerelease: false - uses: actions/checkout@v4 From ec0515409bd98aa1035fce2057942cc873482ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Fri, 27 Oct 2023 01:32:21 +0800 Subject: [PATCH 30/56] Disable cache --- .github/workflows/prebuild.py | 3 ++- .github/workflows/prebuild.yml | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py index d5376e23..e7e59af7 100644 --- a/.github/workflows/prebuild.py +++ b/.github/workflows/prebuild.py @@ -13,6 +13,7 @@ release: name: Create Release runs-on: ubuntu-latest + env: VCPKG_ROOT: ${{ github.workspace }}/vcpkg VCPKG_REVISION: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 Z3_VERSION: 0.12.2 @@ -37,7 +38,7 @@ with: pkgs: z3 triplet: """+triplet+""" - cache-key: """+os+""" + disable-cache: true revision: ${{ env.VCPKG_REVISION }} token: ${{ github.token }} extra-args: --clean-buildtrees-after-build""") diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index c1f4d011..4aacf52a 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -29,7 +29,7 @@ jobs: with: pkgs: z3 triplet: x64-linux - cache-key: ubuntu-latest + disable-cache: true revision: ${{ env.VCPKG_REVISION }} token: ${{ github.token }} extra-args: --clean-buildtrees-after-build @@ -38,7 +38,7 @@ jobs: with: pkgs: z3 triplet: x64-osx - cache-key: macos-latest + disable-cache: true revision: ${{ env.VCPKG_REVISION }} token: ${{ github.token }} extra-args: --clean-buildtrees-after-build @@ -47,7 +47,7 @@ jobs: with: pkgs: z3 triplet: x64-windows-static-md - cache-key: windows-latest + disable-cache: true revision: ${{ env.VCPKG_REVISION }} token: ${{ github.token }} extra-args: --clean-buildtrees-after-build From 049ad9551a153fc2ac805e3f9ff94b72fecad2f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Fri, 27 Oct 2023 01:36:05 +0800 Subject: [PATCH 31/56] Fix an error in CI --- .github/workflows/prebuild.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py index e7e59af7..c45bf35b 100644 --- a/.github/workflows/prebuild.py +++ b/.github/workflows/prebuild.py @@ -56,7 +56,7 @@ GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/x64-linux.tar.gz - asset_name: x64-linux.tar.gz + asset_path: ${{ github.workspace }}/"""+triplet+""".tar.gz + asset_name: """+triplet""".tar.gz asset_content_type: application/gzip """) \ No newline at end of file From 896de4742dccc36378e89ee4b540e404ba838408 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 13:40:44 +0800 Subject: [PATCH 32/56] Implement vcpkg action by ourselves --- .github/workflows/prebuild.py | 38 ++++++++++++++------- .github/workflows/prebuild.yml | 60 ++++++++++++++++++---------------- 2 files changed, 57 insertions(+), 41 deletions(-) diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py index c45bf35b..5bba3f61 100644 --- a/.github/workflows/prebuild.py +++ b/.github/workflows/prebuild.py @@ -14,7 +14,7 @@ name: Create Release runs-on: ubuntu-latest env: - VCPKG_ROOT: ${{ github.workspace }}/vcpkg + VCPKG_ROOT: "${{ github.workspace }}/vcpkg" VCPKG_REVISION: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 Z3_VERSION: 0.12.2 steps: @@ -30,18 +30,32 @@ prerelease: false - uses: actions/checkout@v4 with: - submodules: recursive""") + submodules: recursive + - name: Get latest Github release + uses: cardinalby/git-get-release-action@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + latest: true + repo: microsoft/vcpkg + prerelease: false + draft: false + - name: checkout-vcpkg + uses: actions/checkout@v3 + with: + path: ${{ env.VCPKG_ROOT }} + repository: microsoft/vcpkg + ref: ${{ env.VCPKG_REVISION }} + fetch-depth: 1 + - name: bootstrap-vcpkg + working-directory: ${{ env.VCPKG_ROOT }} + run: ./bootstrap-vcpkg.sh + shell: bash""") for os, triplet, _ in PLATFORM: f.write(""" - name: vcpkg build z3 - uses: johnwason/vcpkg-action@v5 - with: - pkgs: z3 - triplet: """+triplet+""" - disable-cache: true - revision: ${{ env.VCPKG_REVISION }} - token: ${{ github.token }} - extra-args: --clean-buildtrees-after-build""") + working-directory: ${{ env.VCPKG_ROOT }} + run: ./vcpkg install --clean-buildtrees-after-build """ + f"z3:{triplet}") f.write(f""" - name: prepare artifact run: |""") @@ -49,7 +63,7 @@ f.write(""" sh z3-sys/scripts/make_artifact.sh ${{ github.workspace }} ${{ env.VCPKG_ROOT }} """ + f"{triplet} {lib}") for _, triplet, _ in PLATFORM: - f.write(""" + f.write(""" - name: upload artifact uses: actions/upload-release-asset@v1 env: @@ -57,6 +71,6 @@ with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ${{ github.workspace }}/"""+triplet+""".tar.gz - asset_name: """+triplet""".tar.gz + asset_name: """+triplet+""".tar.gz asset_content_type: application/gzip """) \ No newline at end of file diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 4aacf52a..2b95173b 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -7,7 +7,7 @@ jobs: name: Create Release runs-on: ubuntu-latest env: - VCPKG_ROOT: ${{ github.workspace }}/vcpkg + VCPKG_ROOT: "${{ github.workspace }}/vcpkg" VCPKG_REVISION: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 Z3_VERSION: 0.12.2 steps: @@ -24,33 +24,35 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - name: vcpkg build z3 - uses: johnwason/vcpkg-action@v5 + - name: Get latest Github release + uses: cardinalby/git-get-release-action@v1 + env: + GITHUB_TOKEN: ${{ github.token }} with: - pkgs: z3 - triplet: x64-linux - disable-cache: true - revision: ${{ env.VCPKG_REVISION }} - token: ${{ github.token }} - extra-args: --clean-buildtrees-after-build - - name: vcpkg build z3 - uses: johnwason/vcpkg-action@v5 + latest: true + repo: microsoft/vcpkg + prerelease: false + draft: false + - name: checkout-vcpkg + uses: actions/checkout@v3 with: - pkgs: z3 - triplet: x64-osx - disable-cache: true - revision: ${{ env.VCPKG_REVISION }} - token: ${{ github.token }} - extra-args: --clean-buildtrees-after-build + path: ${{ env.VCPKG_ROOT }} + repository: microsoft/vcpkg + ref: ${{ env.VCPKG_REVISION }} + fetch-depth: 1 + - name: bootstrap-vcpkg + working-directory: ${{ env.VCPKG_ROOT }} + run: ./bootstrap-vcpkg.sh + shell: bash - name: vcpkg build z3 - uses: johnwason/vcpkg-action@v5 - with: - pkgs: z3 - triplet: x64-windows-static-md - disable-cache: true - revision: ${{ env.VCPKG_REVISION }} - token: ${{ github.token }} - extra-args: --clean-buildtrees-after-build + working-directory: ${{ env.VCPKG_ROOT }} + run: ./vcpkg install --clean-buildtrees-after-build z3:x64-linux + - name: vcpkg build z3 + working-directory: ${{ env.VCPKG_ROOT }} + run: ./vcpkg install --clean-buildtrees-after-build z3:x64-osx + - name: vcpkg build z3 + working-directory: ${{ env.VCPKG_ROOT }} + run: ./vcpkg install --clean-buildtrees-after-build z3:x64-windows-static-md - name: prepare artifact run: | sh z3-sys/scripts/make_artifact.sh ${{ github.workspace }} ${{ env.VCPKG_ROOT }} x64-linux libz3.a @@ -72,8 +74,8 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/x64-linux.tar.gz - asset_name: x64-linux.tar.gz + asset_path: ${{ github.workspace }}/x64-osx.tar.gz + asset_name: x64-osx.tar.gz asset_content_type: application/gzip - name: upload artifact @@ -82,7 +84,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/x64-linux.tar.gz - asset_name: x64-linux.tar.gz + asset_path: ${{ github.workspace }}/x64-windows-static-md.tar.gz + asset_name: x64-windows-static-md.tar.gz asset_content_type: application/gzip \ No newline at end of file From fce05af1320213413eec7e70d2c0c9975b55abe0 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 13:41:04 +0800 Subject: [PATCH 33/56] Include z3++.h in artifacts --- z3-sys/scripts/make_artifact.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/z3-sys/scripts/make_artifact.sh b/z3-sys/scripts/make_artifact.sh index 65656b24..344b97a7 100644 --- a/z3-sys/scripts/make_artifact.sh +++ b/z3-sys/scripts/make_artifact.sh @@ -9,7 +9,7 @@ ls $VCPKG_ROOT/installed/$VCPKG_TRIPLET/include mkdir "$WORKSPACE/$VCPKG_TRIPLET" -headers=("z3.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") +headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") for i in $headers do cp "$VCPKG_ROOT/installed/$VCPKG_TRIPLET/include/$file" "$WORKSPACE/$VCPKG_TRIPLET/$file" From 1805f7ccc2d69ca65616df8895305ae236ad414e Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 13:46:52 +0800 Subject: [PATCH 34/56] Manually triger the workflow. --- .github/workflows/prebuild.py | 3 +-- .github/workflows/prebuild.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py index 5bba3f61..8cf186e6 100644 --- a/.github/workflows/prebuild.py +++ b/.github/workflows/prebuild.py @@ -7,8 +7,7 @@ f.write("""\ name: Upload prebuilt Z3 on: - push: - branches: [ upload-prebuilt-static-z3 ] + workflow_dispatch: jobs: release: name: Create Release diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 2b95173b..6f476f9a 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -1,7 +1,6 @@ name: Upload prebuilt Z3 on: - push: - branches: [ upload-prebuilt-static-z3 ] + workflow_dispatch: jobs: release: name: Create Release From b7d42f3b9420c1458075125c63104149317944be Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 14:10:45 +0800 Subject: [PATCH 35/56] Deprecating make_artifact.sh --- .github/workflows/prebuild.py | 28 ++++++++----- .github/workflows/prebuild.yml | 77 +++++++++++++++++++++++++++------- 2 files changed, 81 insertions(+), 24 deletions(-) diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py index 8cf186e6..1826c1ba 100644 --- a/.github/workflows/prebuild.py +++ b/.github/workflows/prebuild.py @@ -1,3 +1,4 @@ +# Used to generate prebuild.yml with open("prebuild.yml", "w") as f: PLATFORM = [ ["ubuntu-latest", "x64-linux", "libz3.a"], @@ -50,26 +51,33 @@ working-directory: ${{ env.VCPKG_ROOT }} run: ./bootstrap-vcpkg.sh shell: bash""") - for os, triplet, _ in PLATFORM: + for os, triplet, lib in PLATFORM: f.write(""" - - name: vcpkg build z3 + - name: vcpkg build z3 with triplet """+triplet+""" working-directory: ${{ env.VCPKG_ROOT }} run: ./vcpkg install --clean-buildtrees-after-build """ + f"z3:{triplet}") - f.write(f""" - - name: prepare artifact + + FROM = "${{ env.VCPKG_ROOT }}/installed/"+triplet + TO = '${{ github.workspace }}/'+triplet + f.write(f""" + - name: prepare artifact for {triplet} run: |""") - for _, triplet, lib in PLATFORM: + for header in ["z3.h", "z3++.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h"]: + f.write(f''' + cp "{FROM}/include/{header}" "{TO}/{header}"''') + f.write(f''' + cp "{FROM}/lib/{lib}" "{TO}/{lib}"''') + ARTIFACT = "${{ github.workspace }}/"+triplet+".tar.gz" + f.write(f''' + tar -jcvf "{ARTIFACT}" "{TO}"''') f.write(""" - sh z3-sys/scripts/make_artifact.sh ${{ github.workspace }} ${{ env.VCPKG_ROOT }} """ + f"{triplet} {lib}") - for _, triplet, _ in PLATFORM: - f.write(""" - - name: upload artifact + - name: upload artifact for """+triplet+""" uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/"""+triplet+""".tar.gz + asset_path: """+ARTIFACT+""" asset_name: """+triplet+""".tar.gz asset_content_type: application/gzip """) \ No newline at end of file diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 6f476f9a..05fa282d 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -43,21 +43,28 @@ jobs: working-directory: ${{ env.VCPKG_ROOT }} run: ./bootstrap-vcpkg.sh shell: bash - - name: vcpkg build z3 + - name: vcpkg build z3 with triplet x64-linux working-directory: ${{ env.VCPKG_ROOT }} run: ./vcpkg install --clean-buildtrees-after-build z3:x64-linux - - name: vcpkg build z3 - working-directory: ${{ env.VCPKG_ROOT }} - run: ./vcpkg install --clean-buildtrees-after-build z3:x64-osx - - name: vcpkg build z3 - working-directory: ${{ env.VCPKG_ROOT }} - run: ./vcpkg install --clean-buildtrees-after-build z3:x64-windows-static-md - - name: prepare artifact + - name: prepare artifact for x64-linux run: | - sh z3-sys/scripts/make_artifact.sh ${{ github.workspace }} ${{ env.VCPKG_ROOT }} x64-linux libz3.a - sh z3-sys/scripts/make_artifact.sh ${{ github.workspace }} ${{ env.VCPKG_ROOT }} x64-osx libz3.a - sh z3-sys/scripts/make_artifact.sh ${{ github.workspace }} ${{ env.VCPKG_ROOT }} x64-windows-static-md libz3.lib - - name: upload artifact + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3.h" "${{ github.workspace }}/x64-linux/z3.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3++.h" "${{ github.workspace }}/x64-linux/z3++.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_algebraic.h" "${{ github.workspace }}/x64-linux/z3_algebraic.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_api.h" "${{ github.workspace }}/x64-linux/z3_api.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_ast_containers.h" "${{ github.workspace }}/x64-linux/z3_ast_containers.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_fixedpoint.h" "${{ github.workspace }}/x64-linux/z3_fixedpoint.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_fpa.h" "${{ github.workspace }}/x64-linux/z3_fpa.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_macros.h" "${{ github.workspace }}/x64-linux/z3_macros.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_optimization.h" "${{ github.workspace }}/x64-linux/z3_optimization.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_polynomial.h" "${{ github.workspace }}/x64-linux/z3_polynomial.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_rcf.h" "${{ github.workspace }}/x64-linux/z3_rcf.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_spacer.h" "${{ github.workspace }}/x64-linux/z3_spacer.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_v1.h" "${{ github.workspace }}/x64-linux/z3_v1.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_version.h" "${{ github.workspace }}/x64-linux/z3_version.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/lib/libz3.a" "${{ github.workspace }}/x64-linux/libz3.a" + tar -jcvf "${{ github.workspace }}/x64-linux.tar.gz" "${{ github.workspace }}/x64-linux" + - name: upload artifact for x64-linux uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} @@ -67,7 +74,28 @@ jobs: asset_name: x64-linux.tar.gz asset_content_type: application/gzip - - name: upload artifact + - name: vcpkg build z3 with triplet x64-osx + working-directory: ${{ env.VCPKG_ROOT }} + run: ./vcpkg install --clean-buildtrees-after-build z3:x64-osx + - name: prepare artifact for x64-osx + run: | + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3.h" "${{ github.workspace }}/x64-osx/z3.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3++.h" "${{ github.workspace }}/x64-osx/z3++.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_algebraic.h" "${{ github.workspace }}/x64-osx/z3_algebraic.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_api.h" "${{ github.workspace }}/x64-osx/z3_api.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_ast_containers.h" "${{ github.workspace }}/x64-osx/z3_ast_containers.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_fixedpoint.h" "${{ github.workspace }}/x64-osx/z3_fixedpoint.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_fpa.h" "${{ github.workspace }}/x64-osx/z3_fpa.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_macros.h" "${{ github.workspace }}/x64-osx/z3_macros.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_optimization.h" "${{ github.workspace }}/x64-osx/z3_optimization.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_polynomial.h" "${{ github.workspace }}/x64-osx/z3_polynomial.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_rcf.h" "${{ github.workspace }}/x64-osx/z3_rcf.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_spacer.h" "${{ github.workspace }}/x64-osx/z3_spacer.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_v1.h" "${{ github.workspace }}/x64-osx/z3_v1.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_version.h" "${{ github.workspace }}/x64-osx/z3_version.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/lib/libz3.a" "${{ github.workspace }}/x64-osx/libz3.a" + tar -jcvf "${{ github.workspace }}/x64-osx.tar.gz" "${{ github.workspace }}/x64-osx" + - name: upload artifact for x64-osx uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} @@ -77,7 +105,28 @@ jobs: asset_name: x64-osx.tar.gz asset_content_type: application/gzip - - name: upload artifact + - name: vcpkg build z3 with triplet x64-windows-static-md + working-directory: ${{ env.VCPKG_ROOT }} + run: ./vcpkg install --clean-buildtrees-after-build z3:x64-windows-static-md + - name: prepare artifact for x64-windows-static-md + run: | + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3.h" "${{ github.workspace }}/x64-windows-static-md/z3.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3++.h" "${{ github.workspace }}/x64-windows-static-md/z3++.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_algebraic.h" "${{ github.workspace }}/x64-windows-static-md/z3_algebraic.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_api.h" "${{ github.workspace }}/x64-windows-static-md/z3_api.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_ast_containers.h" "${{ github.workspace }}/x64-windows-static-md/z3_ast_containers.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_fixedpoint.h" "${{ github.workspace }}/x64-windows-static-md/z3_fixedpoint.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_fpa.h" "${{ github.workspace }}/x64-windows-static-md/z3_fpa.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_macros.h" "${{ github.workspace }}/x64-windows-static-md/z3_macros.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_optimization.h" "${{ github.workspace }}/x64-windows-static-md/z3_optimization.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_polynomial.h" "${{ github.workspace }}/x64-windows-static-md/z3_polynomial.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_rcf.h" "${{ github.workspace }}/x64-windows-static-md/z3_rcf.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_spacer.h" "${{ github.workspace }}/x64-windows-static-md/z3_spacer.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_v1.h" "${{ github.workspace }}/x64-windows-static-md/z3_v1.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_version.h" "${{ github.workspace }}/x64-windows-static-md/z3_version.h" + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/lib/libz3.lib" "${{ github.workspace }}/x64-windows-static-md/libz3.lib" + tar -jcvf "${{ github.workspace }}/x64-windows-static-md.tar.gz" "${{ github.workspace }}/x64-windows-static-md" + - name: upload artifact for x64-windows-static-md uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} From 53cf9c330bebabf3cb1fe136103e6093efef297c Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 14:13:08 +0800 Subject: [PATCH 36/56] Simplified prebuild.yml and deprecated make_artifact.sh --- .github/workflows/prebuild.py | 12 +++++-- .github/workflows/prebuild.yml | 63 +++++++++++---------------------- z3-sys/scripts/make_artifact.sh | 19 ---------- 3 files changed, 30 insertions(+), 64 deletions(-) delete mode 100644 z3-sys/scripts/make_artifact.sh diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py index 1826c1ba..a915e203 100644 --- a/.github/workflows/prebuild.py +++ b/.github/workflows/prebuild.py @@ -62,9 +62,15 @@ f.write(f""" - name: prepare artifact for {triplet} run: |""") - for header in ["z3.h", "z3++.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h"]: - f.write(f''' - cp "{FROM}/include/{header}" "{TO}/{header}"''') + HEADERS = ["z3.h", "z3++.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h"] + f.write(f""" + ls "{FROM}/lib" + ls "{FROM}/include" + headers=("{'" "'.join(HEADERS)}") + for header in $headers + do + cp "{FROM}/include/$header" "{TO}/$header" + done""") f.write(f''' cp "{FROM}/lib/{lib}" "{TO}/{lib}"''') ARTIFACT = "${{ github.workspace }}/"+triplet+".tar.gz" diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 05fa282d..e0ada4de 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -48,20 +48,13 @@ jobs: run: ./vcpkg install --clean-buildtrees-after-build z3:x64-linux - name: prepare artifact for x64-linux run: | - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3.h" "${{ github.workspace }}/x64-linux/z3.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3++.h" "${{ github.workspace }}/x64-linux/z3++.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_algebraic.h" "${{ github.workspace }}/x64-linux/z3_algebraic.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_api.h" "${{ github.workspace }}/x64-linux/z3_api.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_ast_containers.h" "${{ github.workspace }}/x64-linux/z3_ast_containers.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_fixedpoint.h" "${{ github.workspace }}/x64-linux/z3_fixedpoint.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_fpa.h" "${{ github.workspace }}/x64-linux/z3_fpa.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_macros.h" "${{ github.workspace }}/x64-linux/z3_macros.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_optimization.h" "${{ github.workspace }}/x64-linux/z3_optimization.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_polynomial.h" "${{ github.workspace }}/x64-linux/z3_polynomial.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_rcf.h" "${{ github.workspace }}/x64-linux/z3_rcf.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_spacer.h" "${{ github.workspace }}/x64-linux/z3_spacer.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_v1.h" "${{ github.workspace }}/x64-linux/z3_v1.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/z3_version.h" "${{ github.workspace }}/x64-linux/z3_version.h" + ls "${{ env.VCPKG_ROOT }}/installed/x64-linux/lib" + ls "${{ env.VCPKG_ROOT }}/installed/x64-linux/include" + headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") + for header in $headers + do + cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/$header" "${{ github.workspace }}/x64-linux/$header" + done cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/lib/libz3.a" "${{ github.workspace }}/x64-linux/libz3.a" tar -jcvf "${{ github.workspace }}/x64-linux.tar.gz" "${{ github.workspace }}/x64-linux" - name: upload artifact for x64-linux @@ -79,20 +72,13 @@ jobs: run: ./vcpkg install --clean-buildtrees-after-build z3:x64-osx - name: prepare artifact for x64-osx run: | - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3.h" "${{ github.workspace }}/x64-osx/z3.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3++.h" "${{ github.workspace }}/x64-osx/z3++.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_algebraic.h" "${{ github.workspace }}/x64-osx/z3_algebraic.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_api.h" "${{ github.workspace }}/x64-osx/z3_api.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_ast_containers.h" "${{ github.workspace }}/x64-osx/z3_ast_containers.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_fixedpoint.h" "${{ github.workspace }}/x64-osx/z3_fixedpoint.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_fpa.h" "${{ github.workspace }}/x64-osx/z3_fpa.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_macros.h" "${{ github.workspace }}/x64-osx/z3_macros.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_optimization.h" "${{ github.workspace }}/x64-osx/z3_optimization.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_polynomial.h" "${{ github.workspace }}/x64-osx/z3_polynomial.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_rcf.h" "${{ github.workspace }}/x64-osx/z3_rcf.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_spacer.h" "${{ github.workspace }}/x64-osx/z3_spacer.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_v1.h" "${{ github.workspace }}/x64-osx/z3_v1.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/z3_version.h" "${{ github.workspace }}/x64-osx/z3_version.h" + ls "${{ env.VCPKG_ROOT }}/installed/x64-osx/lib" + ls "${{ env.VCPKG_ROOT }}/installed/x64-osx/include" + headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") + for header in $headers + do + cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/$header" "${{ github.workspace }}/x64-osx/$header" + done cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/lib/libz3.a" "${{ github.workspace }}/x64-osx/libz3.a" tar -jcvf "${{ github.workspace }}/x64-osx.tar.gz" "${{ github.workspace }}/x64-osx" - name: upload artifact for x64-osx @@ -110,20 +96,13 @@ jobs: run: ./vcpkg install --clean-buildtrees-after-build z3:x64-windows-static-md - name: prepare artifact for x64-windows-static-md run: | - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3.h" "${{ github.workspace }}/x64-windows-static-md/z3.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3++.h" "${{ github.workspace }}/x64-windows-static-md/z3++.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_algebraic.h" "${{ github.workspace }}/x64-windows-static-md/z3_algebraic.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_api.h" "${{ github.workspace }}/x64-windows-static-md/z3_api.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_ast_containers.h" "${{ github.workspace }}/x64-windows-static-md/z3_ast_containers.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_fixedpoint.h" "${{ github.workspace }}/x64-windows-static-md/z3_fixedpoint.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_fpa.h" "${{ github.workspace }}/x64-windows-static-md/z3_fpa.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_macros.h" "${{ github.workspace }}/x64-windows-static-md/z3_macros.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_optimization.h" "${{ github.workspace }}/x64-windows-static-md/z3_optimization.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_polynomial.h" "${{ github.workspace }}/x64-windows-static-md/z3_polynomial.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_rcf.h" "${{ github.workspace }}/x64-windows-static-md/z3_rcf.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_spacer.h" "${{ github.workspace }}/x64-windows-static-md/z3_spacer.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_v1.h" "${{ github.workspace }}/x64-windows-static-md/z3_v1.h" - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/z3_version.h" "${{ github.workspace }}/x64-windows-static-md/z3_version.h" + ls "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/lib" + ls "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include" + headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") + for header in $headers + do + cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/$header" "${{ github.workspace }}/x64-windows-static-md/$header" + done cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/lib/libz3.lib" "${{ github.workspace }}/x64-windows-static-md/libz3.lib" tar -jcvf "${{ github.workspace }}/x64-windows-static-md.tar.gz" "${{ github.workspace }}/x64-windows-static-md" - name: upload artifact for x64-windows-static-md diff --git a/z3-sys/scripts/make_artifact.sh b/z3-sys/scripts/make_artifact.sh deleted file mode 100644 index 344b97a7..00000000 --- a/z3-sys/scripts/make_artifact.sh +++ /dev/null @@ -1,19 +0,0 @@ - -WORKSPACE=$1 -VCPKG_ROOT=$2 -VCPKG_TRIPLET=$3 -LIB=$4 - -ls $VCPKG_ROOT/installed/$VCPKG_TRIPLET/lib -ls $VCPKG_ROOT/installed/$VCPKG_TRIPLET/include - -mkdir "$WORKSPACE/$VCPKG_TRIPLET" - -headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") -for i in $headers -do -cp "$VCPKG_ROOT/installed/$VCPKG_TRIPLET/include/$file" "$WORKSPACE/$VCPKG_TRIPLET/$file" -done -cp "$VCPKG_ROOT/installed/$VCPKG_TRIPLET/lib/$LIB" "$WORKSPACE/$VCPKG_TRIPLET/$LIB" - -tar -jcvf "$WORKSPACE/$VCPKG_TRIPLET.tar.gz" "$WORKSPACE/$VCPKG_TRIPLET" \ No newline at end of file From 01f1486532a0e6afbcc0ec06881215b9c86c39f6 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 14:20:24 +0800 Subject: [PATCH 37/56] Simplify an echo in rust.yml --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c0b1b7f8..53b131fb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -120,7 +120,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 From 6349e6c809a6c6563b7b19e4a56659d3e446cef7 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 14:35:41 +0800 Subject: [PATCH 38/56] Automatically triger the workflow. I couldn't find the button. --- .github/workflows/prebuild.py | 2 ++ .github/workflows/prebuild.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py index a915e203..d2b40a2a 100644 --- a/.github/workflows/prebuild.py +++ b/.github/workflows/prebuild.py @@ -9,6 +9,8 @@ name: Upload prebuilt Z3 on: workflow_dispatch: + push: + branches: [ upload-prebuilt-static-z3 ] jobs: release: name: Create Release diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index e0ada4de..8a2e78b0 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -1,6 +1,8 @@ name: Upload prebuilt Z3 on: workflow_dispatch: + push: + branches: [ upload-prebuilt-static-z3 ] jobs: release: name: Create Release From 888d58e0a7e4127f1d074a57c3de572c096f94fe Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 16:02:12 +0800 Subject: [PATCH 39/56] Fix an error in CI Create directory before it's used. --- .github/workflows/prebuild.py | 1 + .github/workflows/prebuild.yml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py index d2b40a2a..cb831e8b 100644 --- a/.github/workflows/prebuild.py +++ b/.github/workflows/prebuild.py @@ -68,6 +68,7 @@ f.write(f""" ls "{FROM}/lib" ls "{FROM}/include" + mkdir "{TO}" headers=("{'" "'.join(HEADERS)}") for header in $headers do diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 8a2e78b0..272d1dd6 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -52,6 +52,7 @@ jobs: run: | ls "${{ env.VCPKG_ROOT }}/installed/x64-linux/lib" ls "${{ env.VCPKG_ROOT }}/installed/x64-linux/include" + mkdir "${{ github.workspace }}/x64-linux" headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") for header in $headers do @@ -76,6 +77,7 @@ jobs: run: | ls "${{ env.VCPKG_ROOT }}/installed/x64-osx/lib" ls "${{ env.VCPKG_ROOT }}/installed/x64-osx/include" + mkdir "${{ github.workspace }}/x64-osx" headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") for header in $headers do @@ -100,6 +102,7 @@ jobs: run: | ls "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/lib" ls "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include" + mkdir "${{ github.workspace }}/x64-windows-static-md" headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") for header in $headers do From f7821e5c534ad21594a33cae6cb81addc6f59111 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 23:02:51 +0800 Subject: [PATCH 40/56] Another way to get and upload built files. Not elegant in some aspects. --- .github/workflows/prebuild.py | 92 ------------------------- .github/workflows/prebuild.yml | 122 --------------------------------- .github/workflows/rust.yml | 28 ++++++++ 3 files changed, 28 insertions(+), 214 deletions(-) delete mode 100644 .github/workflows/prebuild.py delete mode 100644 .github/workflows/prebuild.yml diff --git a/.github/workflows/prebuild.py b/.github/workflows/prebuild.py deleted file mode 100644 index cb831e8b..00000000 --- a/.github/workflows/prebuild.py +++ /dev/null @@ -1,92 +0,0 @@ -# Used to generate prebuild.yml -with open("prebuild.yml", "w") as f: - PLATFORM = [ - ["ubuntu-latest", "x64-linux", "libz3.a"], - ["macos-latest", "x64-osx", "libz3.a"], - ["windows-latest", "x64-windows-static-md", "libz3.lib"], - ] - f.write("""\ -name: Upload prebuilt Z3 -on: - workflow_dispatch: - push: - branches: [ upload-prebuilt-static-z3 ] -jobs: - release: - name: Create Release - runs-on: ubuntu-latest - env: - VCPKG_ROOT: "${{ github.workspace }}/vcpkg" - VCPKG_REVISION: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 - Z3_VERSION: 0.12.2 - steps: - - name: Create Release - id: create_release - 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 - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Get latest Github release - uses: cardinalby/git-get-release-action@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - latest: true - repo: microsoft/vcpkg - prerelease: false - draft: false - - name: checkout-vcpkg - uses: actions/checkout@v3 - with: - path: ${{ env.VCPKG_ROOT }} - repository: microsoft/vcpkg - ref: ${{ env.VCPKG_REVISION }} - fetch-depth: 1 - - name: bootstrap-vcpkg - working-directory: ${{ env.VCPKG_ROOT }} - run: ./bootstrap-vcpkg.sh - shell: bash""") - for os, triplet, lib in PLATFORM: - f.write(""" - - name: vcpkg build z3 with triplet """+triplet+""" - working-directory: ${{ env.VCPKG_ROOT }} - run: ./vcpkg install --clean-buildtrees-after-build """ + f"z3:{triplet}") - - FROM = "${{ env.VCPKG_ROOT }}/installed/"+triplet - TO = '${{ github.workspace }}/'+triplet - f.write(f""" - - name: prepare artifact for {triplet} - run: |""") - HEADERS = ["z3.h", "z3++.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h"] - f.write(f""" - ls "{FROM}/lib" - ls "{FROM}/include" - mkdir "{TO}" - headers=("{'" "'.join(HEADERS)}") - for header in $headers - do - cp "{FROM}/include/$header" "{TO}/$header" - done""") - f.write(f''' - cp "{FROM}/lib/{lib}" "{TO}/{lib}"''') - ARTIFACT = "${{ github.workspace }}/"+triplet+".tar.gz" - f.write(f''' - tar -jcvf "{ARTIFACT}" "{TO}"''') - f.write(""" - - name: upload artifact for """+triplet+""" - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: """+ARTIFACT+""" - asset_name: """+triplet+""".tar.gz - asset_content_type: application/gzip - """) \ No newline at end of file diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml deleted file mode 100644 index 272d1dd6..00000000 --- a/.github/workflows/prebuild.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Upload prebuilt Z3 -on: - workflow_dispatch: - push: - branches: [ upload-prebuilt-static-z3 ] -jobs: - release: - name: Create Release - runs-on: ubuntu-latest - env: - VCPKG_ROOT: "${{ github.workspace }}/vcpkg" - VCPKG_REVISION: 5c82f7e6372c9b0ea25e1fd829dd50235ef37629 - Z3_VERSION: 0.12.2 - steps: - - name: Create Release - id: create_release - 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 - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Get latest Github release - uses: cardinalby/git-get-release-action@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - latest: true - repo: microsoft/vcpkg - prerelease: false - draft: false - - name: checkout-vcpkg - uses: actions/checkout@v3 - with: - path: ${{ env.VCPKG_ROOT }} - repository: microsoft/vcpkg - ref: ${{ env.VCPKG_REVISION }} - fetch-depth: 1 - - name: bootstrap-vcpkg - working-directory: ${{ env.VCPKG_ROOT }} - run: ./bootstrap-vcpkg.sh - shell: bash - - name: vcpkg build z3 with triplet x64-linux - working-directory: ${{ env.VCPKG_ROOT }} - run: ./vcpkg install --clean-buildtrees-after-build z3:x64-linux - - name: prepare artifact for x64-linux - run: | - ls "${{ env.VCPKG_ROOT }}/installed/x64-linux/lib" - ls "${{ env.VCPKG_ROOT }}/installed/x64-linux/include" - mkdir "${{ github.workspace }}/x64-linux" - headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") - for header in $headers - do - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/include/$header" "${{ github.workspace }}/x64-linux/$header" - done - cp "${{ env.VCPKG_ROOT }}/installed/x64-linux/lib/libz3.a" "${{ github.workspace }}/x64-linux/libz3.a" - tar -jcvf "${{ github.workspace }}/x64-linux.tar.gz" "${{ github.workspace }}/x64-linux" - - name: upload artifact for x64-linux - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/x64-linux.tar.gz - asset_name: x64-linux.tar.gz - asset_content_type: application/gzip - - - name: vcpkg build z3 with triplet x64-osx - working-directory: ${{ env.VCPKG_ROOT }} - run: ./vcpkg install --clean-buildtrees-after-build z3:x64-osx - - name: prepare artifact for x64-osx - run: | - ls "${{ env.VCPKG_ROOT }}/installed/x64-osx/lib" - ls "${{ env.VCPKG_ROOT }}/installed/x64-osx/include" - mkdir "${{ github.workspace }}/x64-osx" - headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") - for header in $headers - do - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/include/$header" "${{ github.workspace }}/x64-osx/$header" - done - cp "${{ env.VCPKG_ROOT }}/installed/x64-osx/lib/libz3.a" "${{ github.workspace }}/x64-osx/libz3.a" - tar -jcvf "${{ github.workspace }}/x64-osx.tar.gz" "${{ github.workspace }}/x64-osx" - - name: upload artifact for x64-osx - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/x64-osx.tar.gz - asset_name: x64-osx.tar.gz - asset_content_type: application/gzip - - - name: vcpkg build z3 with triplet x64-windows-static-md - working-directory: ${{ env.VCPKG_ROOT }} - run: ./vcpkg install --clean-buildtrees-after-build z3:x64-windows-static-md - - name: prepare artifact for x64-windows-static-md - run: | - ls "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/lib" - ls "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include" - mkdir "${{ github.workspace }}/x64-windows-static-md" - headers=("z3.h" "z3++.h" "z3_algebraic.h" "z3_api.h" "z3_ast_containers.h" "z3_fixedpoint.h" "z3_fpa.h" "z3_macros.h" "z3_optimization.h" "z3_polynomial.h" "z3_rcf.h" "z3_spacer.h" "z3_v1.h" "z3_version.h") - for header in $headers - do - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/include/$header" "${{ github.workspace }}/x64-windows-static-md/$header" - done - cp "${{ env.VCPKG_ROOT }}/installed/x64-windows-static-md/lib/libz3.lib" "${{ github.workspace }}/x64-windows-static-md/libz3.lib" - tar -jcvf "${{ github.workspace }}/x64-windows-static-md.tar.gz" "${{ github.workspace }}/x64-windows-static-md" - - name: upload artifact for x64-windows-static-md - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/x64-windows-static-md.tar.gz - asset_name: x64-windows-static-md.tar.gz - asset_content_type: application/gzip - \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 53b131fb..09b2ffdb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -107,6 +107,7 @@ jobs: runs-on: ${{ matrix.os }} env: VCPKG_ROOT: ${{ github.workspace }}/vcpkg + Z3_VERSION: 0.12.2 steps: - uses: actions/checkout@v4 with: @@ -135,6 +136,33 @@ jobs: run: rustup default - name: Test `z3-sys` and `z3` with vcpkg installed Z3 run: cargo test --workspace --features vcpkg + - name: git-get-release-action + continue-on-error: true + id: get_release + uses: cardinalby/git-get-release-action@1.2.4 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + releaseName: ${{ env.Z3_VERSION }} + - name: Compress built z3. + continue-on-error: true + run: + ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib" + ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include" + mkdir "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}" + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3*.h" "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}" + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib/libz3.*" "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}" + tar -jcvf "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz" "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}" + - name: Upload built z3. + continue-on-error: true + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.get_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz + asset_name: ${{ matrix.vcpkg_triplet }}.tar.gz + asset_content_type: application/gzip run_clippy: runs-on: macos-latest From ddb8af8f23425746ac33b46b5efd238910d2fcd4 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 23:25:54 +0800 Subject: [PATCH 41/56] Fix an error in CI. Added a vertical line. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4aa0e47f..75343f5c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -146,7 +146,7 @@ jobs: releaseName: ${{ env.Z3_VERSION }} - name: Compress built z3. continue-on-error: true - run: + run: | ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib" ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include" mkdir "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}" From fe7828fbb2bf51bb69ccd24e400e2590d8e65591 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Fri, 27 Oct 2023 23:56:56 +0800 Subject: [PATCH 42/56] Avoid too complex logic in CI --- .github/workflows/rust.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 75343f5c..46250951 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -149,10 +149,7 @@ jobs: run: | ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib" ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include" - mkdir "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}" - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3*.h" "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}" - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib/libz3.*" "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}" - tar -jcvf "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz" "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}" + tar -jcvf "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz" "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/" - name: Upload built z3. continue-on-error: true uses: actions/upload-release-asset@v1 From bd832bb7a8bcc36de030553488af15a23baea2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Sat, 28 Oct 2023 00:23:09 +0800 Subject: [PATCH 43/56] Fixing an error in CI on Windows --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 46250951..e83c5380 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -149,7 +149,7 @@ jobs: run: | ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib" ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include" - tar -jcvf "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz" "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/" + tar -jcvf "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz" "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}" - name: Upload built z3. continue-on-error: true uses: actions/upload-release-asset@v1 From 63987ba2f2a24aedfa757f190215a8c28d80ef82 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Sat, 28 Oct 2023 15:33:13 +0800 Subject: [PATCH 44/56] CI: Hard code copied files. Otherwise things will be too big. --- .github/workflows/rust.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e83c5380..708e7173 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -98,12 +98,15 @@ 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 @@ -149,7 +152,23 @@ jobs: run: | ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib" ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include" - tar -jcvf "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz" "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}" + mkdir ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib/${{ matrix.lib }}" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3++.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_algebraic.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_api.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_ast_containers.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_fixedpoint.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_fpa.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_macros.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_optimization.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_polynomial.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_rcf.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_spacer.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_v1.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_version.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + tar -jcvf "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - name: Upload built z3. continue-on-error: true uses: actions/upload-release-asset@v1 From 8a362ae9ef25660021b093617bfd838e893b753f Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Sat, 28 Oct 2023 23:37:51 +0800 Subject: [PATCH 45/56] Use python shell to collect and compress. --- .github/workflows/rust.yml | 126 ++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 59 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 708e7173..9620ec34 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,9 +15,9 @@ 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: @@ -25,42 +25,42 @@ jobs: 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: @@ -149,26 +149,34 @@ jobs: releaseName: ${{ env.Z3_VERSION }} - name: Compress built z3. continue-on-error: true + shell: python run: | - ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib" - ls "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include" - mkdir ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/lib/${{ matrix.lib }}" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3++.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_algebraic.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_api.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_ast_containers.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_fixedpoint.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_fpa.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_macros.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_optimization.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_polynomial.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_rcf.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_spacer.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_v1.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - cp "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/include/z3_version.h" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} - tar -jcvf "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz" ${{ github.workspace }}/${{ matrix.vcpkg_triplet }} + from shutil import make_archive, copyfile + from os import mkdir, listdir + + HEADERS = [ + "z3++.h", "z3.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h" + ] + FROM = "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/" + TO = "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}/" + LIB = "${{ 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 HEADERS: + copyfile(FROM + "include/" + header, TO + header) + + make_archive( + base_name="${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz", + format="gztar", + root_dir="${{ github.workspace }}/${{ matrix.vcpkg_triplet }}", + base_dir="${{ github.workspace }}/${{ matrix.vcpkg_triplet }}", + verbose=True, + ) + print("workspace:", "${{ github.workspace }}")) + - name: Upload built z3. continue-on-error: true uses: actions/upload-release-asset@v1 @@ -183,8 +191,8 @@ jobs: 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 From 475f4d61df680e61499eaa06df54e380acb94560 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Sat, 28 Oct 2023 23:45:13 +0800 Subject: [PATCH 46/56] Fix an error in CI. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9620ec34..57287bae 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -175,7 +175,7 @@ jobs: base_dir="${{ github.workspace }}/${{ matrix.vcpkg_triplet }}", verbose=True, ) - print("workspace:", "${{ github.workspace }}")) + print("workspace:", "${{ github.workspace }}") - name: Upload built z3. continue-on-error: true From 40090f70d67c07a9101d8a55c226606f4dc73152 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Sun, 29 Oct 2023 00:13:59 +0800 Subject: [PATCH 47/56] Fix an error in CI. --- .github/workflows/rust.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 57287bae..e3ba9497 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -150,6 +150,7 @@ jobs: - name: Compress built z3. continue-on-error: true shell: python + working-directory: ${{ github.workspace }} run: | from shutil import make_archive, copyfile from os import mkdir, listdir @@ -171,11 +172,11 @@ jobs: make_archive( base_name="${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz", format="gztar", - root_dir="${{ github.workspace }}/${{ matrix.vcpkg_triplet }}", + root_dir="${{ github.workspace }}", base_dir="${{ github.workspace }}/${{ matrix.vcpkg_triplet }}", verbose=True, ) - print("workspace:", "${{ github.workspace }}") + print("workspace:", listdir("${{ github.workspace }}")) - name: Upload built z3. continue-on-error: true From b0d0370ed49515cee00ee358f2056e94589f9046 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Sun, 29 Oct 2023 02:13:22 +0800 Subject: [PATCH 48/56] Fix an error in CI --- .github/workflows/rust.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e3ba9497..22e8c6a5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -154,30 +154,32 @@ jobs: run: | from shutil import make_archive, copyfile from os import mkdir, listdir - + from pathlib import Path + HEADERS = [ "z3++.h", "z3.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h" ] - FROM = "${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}/" - TO = "${{ github.workspace }}/${{ matrix.vcpkg_triplet }}/" - LIB = "${{ matrix.lib }}" - - print("`include` dir:", listdir(FROM + "include/")) - print("`lib` dir:", listdir(FROM + "lib/")) + FROM = Path("${{ env.VCPKG_ROOT }}", "installed", + "${{ matrix.vcpkg_triplet }}") + TO = Path("${{ github.workspace }}", "${{ matrix.vcpkg_triplet }}") + LIB = Path("${{ matrix.lib }}") + + print("`include` dir:", listdir(FROM / "include")) + print("`lib` dir:", listdir(FROM / "lib")) mkdir(TO) - copyfile(FROM + "lib/" + LIB, TO + LIB) + copyfile(FROM / "lib" / LIB, TO / LIB) for header in HEADERS: - copyfile(FROM + "include/" + header, TO + header) - + copyfile(FROM / "include/" / header, TO / header) + make_archive( - base_name="${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz", + base_name="${{ matrix.vcpkg_triplet }}", format="gztar", - root_dir="${{ github.workspace }}", - base_dir="${{ github.workspace }}/${{ matrix.vcpkg_triplet }}", + root_dir=".", + base_dir="${{ matrix.vcpkg_triplet }}", verbose=True, ) print("workspace:", listdir("${{ github.workspace }}")) - + - name: Upload built z3. continue-on-error: true uses: actions/upload-release-asset@v1 From 4a99f76f3868819f5e53eda0d01249e766a827f1 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Sun, 29 Oct 2023 02:54:03 +0800 Subject: [PATCH 49/56] Fix escape in python script; use python 3.10 --- .github/workflows/rust.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 22e8c6a5..03a27041 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -147,6 +147,9 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: releaseName: ${{ env.Z3_VERSION }} + - uses: actions/setup-python@v4 + with: + python-version: '3.10' - name: Compress built z3. continue-on-error: true shell: python @@ -159,10 +162,9 @@ jobs: HEADERS = [ "z3++.h", "z3.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h" ] - FROM = Path("${{ env.VCPKG_ROOT }}", "installed", - "${{ matrix.vcpkg_triplet }}") - TO = Path("${{ github.workspace }}", "${{ matrix.vcpkg_triplet }}") - LIB = Path("${{ matrix.lib }}") + 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")) @@ -172,14 +174,14 @@ jobs: copyfile(FROM / "include/" / header, TO / header) make_archive( - base_name="${{ matrix.vcpkg_triplet }}", + base_name=r"${{ matrix.vcpkg_triplet }}", format="gztar", root_dir=".", - base_dir="${{ matrix.vcpkg_triplet }}", + base_dir=r"${{ matrix.vcpkg_triplet }}", verbose=True, ) - print("workspace:", listdir("${{ github.workspace }}")) - + print("workspace:", listdir(r"${{ github.workspace }}")) + - name: Upload built z3. continue-on-error: true uses: actions/upload-release-asset@v1 From afa2a92d6149e52555cf89bb18e208fb67cba920 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Sun, 29 Oct 2023 03:08:20 +0800 Subject: [PATCH 50/56] Fix an error in CI --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 03a27041..f4247a22 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -163,7 +163,7 @@ jobs: "z3++.h", "z3.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h" ] FROM = Path(r"${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}") - TO = Path(r"${{ github.workspace }}/{{ matrix.vcpkg_triplet }}") + TO = Path(r"${{ github.workspace }}/${{ matrix.vcpkg_triplet }}") LIB = Path(r"${{ matrix.lib }}") print("`include` dir:", listdir(FROM / "include")) From d1209bddd1d10f0121030570fa5ad610ee0e1fcb Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Sun, 29 Oct 2023 10:15:37 +0800 Subject: [PATCH 51/56] Skip compression if archive already exists --- .github/workflows/rust.yml | 83 +++++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f4247a22..ddfcf64e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -149,42 +149,69 @@ jobs: releaseName: ${{ env.Z3_VERSION }} - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: "3.10" - name: Compress built z3. - continue-on-error: true shell: python + id: compress_z3 working-directory: ${{ github.workspace }} run: | from shutil import make_archive, copyfile - from os import mkdir, listdir + from os import mkdir, listdir, environ from pathlib import Path - - HEADERS = [ - "z3++.h", "z3.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h" - ] - 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 HEADERS: - 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 }}")) - + from json import loads + + + def main(): + ASSETS_STRING = r""" + ${{ steps.get_release.outputs.assets }} + """ + ASSETS: list[dict] = loads(ASSETS_STRING) + + found: bool = False + for asset in ASSETS: + if 'name' in asset and asset['name'] == r"${{ matrix.vcpkg_triplet }}.tar.gz": + found = True + break + if "GITHUB_OUTPUT" in environ: + OUT = environ["GITHUB_OUTPUT"] + with open(OUT, "a") as o: + o.write(f"FOUND={int(found)}\n") + else: + print("$GITHUB_OUTPUT not found.") + if found: + print("Archive already uploaded, skipping.") + return + + HEADERS = [ + "z3++.h", "z3.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h" + ] + 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 HEADERS: + 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 built z3. - continue-on-error: true uses: actions/upload-release-asset@v1 + if: ${{ !steps.compress_z3.outputs.found }} env: GITHUB_TOKEN: ${{ github.token }} with: From 4dcfb1341cc8f4a4ab2efd614d311c0650517475 Mon Sep 17 00:00:00 2001 From: TheVeryDarkness <3266343194@qq.com> Date: Sun, 29 Oct 2023 11:28:55 +0800 Subject: [PATCH 52/56] Correct output case. --- .github/workflows/rust.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ddfcf64e..a6189593 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -159,14 +159,14 @@ jobs: from os import mkdir, listdir, environ from pathlib import Path from json import loads - - + + def main(): ASSETS_STRING = r""" ${{ steps.get_release.outputs.assets }} """ ASSETS: list[dict] = loads(ASSETS_STRING) - + found: bool = False for asset in ASSETS: if 'name' in asset and asset['name'] == r"${{ matrix.vcpkg_triplet }}.tar.gz": @@ -175,13 +175,13 @@ jobs: if "GITHUB_OUTPUT" in environ: OUT = environ["GITHUB_OUTPUT"] with open(OUT, "a") as o: - o.write(f"FOUND={int(found)}\n") + o.write(f"found={int(found)}\n") else: print("$GITHUB_OUTPUT not found.") if found: print("Archive already uploaded, skipping.") return - + HEADERS = [ "z3++.h", "z3.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h" ] @@ -189,14 +189,14 @@ jobs: 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 HEADERS: copyfile(FROM / "include/" / header, TO / header) - + make_archive( base_name=r"${{ matrix.vcpkg_triplet }}", format="gztar", @@ -205,10 +205,10 @@ jobs: verbose=True, ) print("workspace:", listdir(r"${{ github.workspace }}")) - - + + main() - + - name: Upload built z3. uses: actions/upload-release-asset@v1 if: ${{ !steps.compress_z3.outputs.found }} From df436dfcf0807608d3ad53b9aa98be115af5d488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Sun, 29 Oct 2023 14:15:30 +0800 Subject: [PATCH 53/56] Correcting output of Python script --- .github/workflows/rust.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a6189593..a49d9aef 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -150,16 +150,23 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.10" + - name: Install Python dependencies + run: python -m pip install github-action-utils - 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 + # actions-toolkit + # from actions_toolkit import core + # github-action-utils + from github_action_utils import set_output def main(): ASSETS_STRING = r""" @@ -172,12 +179,8 @@ jobs: if 'name' in asset and asset['name'] == r"${{ matrix.vcpkg_triplet }}.tar.gz": found = True break - if "GITHUB_OUTPUT" in environ: - OUT = environ["GITHUB_OUTPUT"] - with open(OUT, "a") as o: - o.write(f"found={int(found)}\n") - else: - print("$GITHUB_OUTPUT not found.") + + set_output("found", int(found)) if found: print("Archive already uploaded, skipping.") return @@ -208,7 +211,6 @@ jobs: main() - - name: Upload built z3. uses: actions/upload-release-asset@v1 if: ${{ !steps.compress_z3.outputs.found }} From f5c9abc66289c68210f96fa455fa280ebd01c31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Sun, 29 Oct 2023 14:29:17 +0800 Subject: [PATCH 54/56] Use another action that enables overwrite --- .github/workflows/rust.yml | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a49d9aef..3755ef41 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -163,28 +163,7 @@ jobs: from pathlib import Path from json import loads - # actions-toolkit - # from actions_toolkit import core - # github-action-utils - from github_action_utils import set_output - def main(): - ASSETS_STRING = r""" - ${{ steps.get_release.outputs.assets }} - """ - ASSETS: list[dict] = loads(ASSETS_STRING) - - found: bool = False - for asset in ASSETS: - if 'name' in asset and asset['name'] == r"${{ matrix.vcpkg_triplet }}.tar.gz": - found = True - break - - set_output("found", int(found)) - if found: - print("Archive already uploaded, skipping.") - return - HEADERS = [ "z3++.h", "z3.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h" ] @@ -211,16 +190,13 @@ jobs: main() - - name: Upload built z3. - uses: actions/upload-release-asset@v1 - if: ${{ !steps.compress_z3.outputs.found }} - env: - GITHUB_TOKEN: ${{ github.token }} + - name: Upload files to a GitHub release + uses: svenstaro/upload-release-action@2.7.0 with: - upload_url: ${{ steps.get_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz - asset_name: ${{ matrix.vcpkg_triplet }}.tar.gz - asset_content_type: application/gzip + file: ${{ github.workspace }}/${{ matrix.vcpkg_triplet }}.tar.gz + overwrite: true + tag: ${{ env.Z3_VERSION }} + run_clippy: runs-on: macos-latest From f7e32e6f6c7ec646f978e96a3c09031d2344fa1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Sun, 29 Oct 2023 14:44:13 +0800 Subject: [PATCH 55/56] Try creating a release before getting its info --- .github/workflows/rust.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3755ef41..79615c20 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -139,8 +139,17 @@ jobs: run: rustup default - name: Test `z3-sys` and `z3` with vcpkg installed Z3 run: cargo test --workspace --features vcpkg - - name: git-get-release-action + - 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/git-get-release-action@1.2.4 env: From c0dbcbf9b788999d12661b33c236a99ea13f9ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E5=A5=95=20=E9=BB=84?= <3266343194@qq.com> Date: Sun, 29 Oct 2023 14:45:23 +0800 Subject: [PATCH 56/56] Traverse headers list; remove an unused step. --- .github/workflows/rust.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 79615c20..c9a0073e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -159,8 +159,6 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.10" - - name: Install Python dependencies - run: python -m pip install github-action-utils - name: Compress built z3. shell: python id: compress_z3 @@ -172,12 +170,9 @@ jobs: from pathlib import Path from json import loads + def main(): - HEADERS = [ - "z3++.h", "z3.h", "z3_algebraic.h", "z3_api.h", "z3_ast_containers.h", "z3_fixedpoint.h", "z3_fpa.h", "z3_macros.h", "z3_optimization.h", "z3_polynomial.h", "z3_rcf.h", "z3_spacer.h", "z3_v1.h", "z3_version.h" - ] - FROM = Path( - r"${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}") + FROM = Path(r"${{ env.VCPKG_ROOT }}/installed/${{ matrix.vcpkg_triplet }}") TO = Path(r"${{ github.workspace }}/${{ matrix.vcpkg_triplet }}") LIB = Path(r"${{ matrix.lib }}") @@ -185,8 +180,9 @@ jobs: print("`lib` dir:", listdir(FROM / "lib")) mkdir(TO) copyfile(FROM / "lib" / LIB, TO / LIB) - for header in HEADERS: - copyfile(FROM / "include/" / header, TO / header) + 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 }}",