From c1601898b84808c75ae6dbd629a1007848caf5d2 Mon Sep 17 00:00:00 2001 From: hermanventer Date: Mon, 23 Oct 2023 13:05:19 -0700 Subject: [PATCH] Futz around with CI --- .github/workflows/mirai_on_mirai.yml | 56 +++++++++++++++++++ .github/workflows/rust.yml | 82 +++++++++++++++++----------- Cargo.lock | 2 +- checker/Cargo.toml | 6 +- 4 files changed, 109 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/mirai_on_mirai.yml diff --git a/.github/workflows/mirai_on_mirai.yml b/.github/workflows/mirai_on_mirai.yml new file mode 100644 index 00000000..3a31f450 --- /dev/null +++ b/.github/workflows/mirai_on_mirai.yml @@ -0,0 +1,56 @@ +name: MIRAI on MIRAI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build_with_vcpkg_installed_z3: + strategy: + matrix: + build: [macos, windows] #[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@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' + - run: echo Installing 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: Install MIRAI + run: | + cargo install --force --path ./checker + - name: Run MIRAI on MIRAI + run: | + cargo mirai \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e7703fac..2c30d763 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,4 +1,4 @@ -name: MIRAI on MIRAI +name: Continuous Integration on: push: @@ -7,50 +7,66 @@ on: branches: [ main ] jobs: - build_with_vcpkg_installed_z3: - strategy: - matrix: - 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: windows - os: windows-latest - vcpkg_triplet: x64-windows-static-md - runs-on: ${{ matrix.os }} - env: - VCPKG_ROOT: ${{ github.workspace }}/vcpkg + clippy: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.5.2 + + - name: Run Clippy + run: | + cargo clippy --no-default-features --all-targets -- -D warnings + + tests: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3.5.2 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' - - run: echo Installing 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 }} + triplet: x64-osx + cache-key: macos-latest revision: master token: ${{ github.token }} extra-args: --clean-buildtrees-after-build + + - name: Execute tests + run: | + cargo test --all -- --test-threads=1 + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests" + + - name: Setup grcov + run: | + cargo install grcov + + - name: Run grcov + run: | + zip -0 cov.zip $(find . -name "mirai*.gc*" -print) + grcov cov.zip -s . -t lcov --llvm --ignore-not-existing --ignore "/*" -o lcov.info + + - name: Upload coverage data to codecov.io + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: "lcov.info" + + mirai_on_mirai_ubuntu: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3.5.2 + - name: Install MIRAI run: | - cargo install --force --path ./checker + cargo install --force --path ./checker --no-default-features --features static-link-z3 + - name: Run MIRAI on MIRAI run: | - cargo mirai \ No newline at end of file + cargo mirai --no-default-features \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index f1fa55e9..2c9c01d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1188,7 +1188,7 @@ dependencies = [ [[package]] name = "z3-sys" version = "0.8.1" -source = "git+https://github.com/prove-rs/z3.rs.git#d49d3564ceccdb887be62f32dd9d6c852b583dae" +source = "git+https://github.com/prove-rs/z3.rs.git#1335297b447a281ba90497481865e31b48c40508" dependencies = [ "bindgen", "vcpkg", diff --git a/checker/Cargo.toml b/checker/Cargo.toml index f1d08a65..77834d22 100644 --- a/checker/Cargo.toml +++ b/checker/Cargo.toml @@ -49,7 +49,7 @@ shellwords = "*" sled = "*" tar = "0.4.38" tempfile = "*" -z3-sys = { version = "*", git="https://github.com/prove-rs/z3.rs.git", features = ["vcpkg"], optional = true } +z3-sys = { version = "*", git="https://github.com/prove-rs/z3.rs.git", optional = true } [dev-dependencies] walkdir = "*" @@ -65,6 +65,6 @@ contracts = { version = "0.6.0", features = ["mirai_assertions"] } [features] default = ["z3"] -z3 = ["dep:z3-sys"] - +z3 = ["z3-sys/vcpkg"] +static-link-z3 = ["z3-sys/static-link-z3"]