From 2431c3f16f58d3732e4bda89402f85ff70c8b69d Mon Sep 17 00:00:00 2001 From: Al Liu Date: Fri, 24 May 2024 22:12:55 +0800 Subject: [PATCH] Cleanup CI --- .github/workflows/benchmark.yml | 64 +++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 8 ++--- ci/miri.sh | 4 +-- ci/sanitizer.sh | 6 ++-- 4 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000..74828d5 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,64 @@ +name: Benchmark + +on: + push: + branches: + - main + paths-ignore: + - 'README' + - 'COPYRIGHT' + - 'LICENSE-*' + - '**.md' + - '**.txt' + pull_request: + paths-ignore: + - 'README' + - 'COPYRIGHT' + - 'LICENSE-*' + - '**.md' + - '**.txt' + +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: -Dwarnings + RUST_BACKTRACE: 1 + nightly: nightly + stable: stable + +jobs: + benchmark: + name: benchmark + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Cache cargo build and registry + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-test- + - name: Install Rust + # --no-self-update is necessary because the windows environment cannot self-update rustup.exe. + run: rustup update stable --no-self-update && rustup default stable + - name: Cache ~/.cargo + uses: actions/cache@v3 + with: + path: ~/.cargo + key: ${{ runner.os }}-coverage-dotcargo + - name: Run test + run: cargo bench + - name: Upload benchmark results + uses: actions/upload-artifact@v3 + with: + name: benchmark-results + path: target/criterion \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c160a02..7460b84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,7 +104,7 @@ jobs: run: | cargo install cross cross build --target ${{ matrix.target }} - if: matrix.target != 'wasm32-unknown-unknown' || matrix.target != 'wasm32-wasi' + if: matrix.target != 'wasm32-unknown-unknown' && matrix.target != 'wasm32-wasi' # WASM support - name: cargo build --target ${{ matrix.target }} run: | @@ -210,8 +210,6 @@ jobs: run: rustup update $nightly && rustup default $nightly - name: Install rust-src run: rustup component add rust-src - - name: Install cargo-hack - run: cargo install cargo-hack - name: ASAN / LSAN / TSAN run: ci/sanitizer.sh @@ -236,8 +234,6 @@ jobs: key: ${{ runner.os }}-miri-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-miri- - - name: Install cargo-hack - run: cargo install cargo-hack - name: Miri run: ci/miri.sh loom: @@ -264,7 +260,7 @@ jobs: - name: Install Rust run: rustup update $nightly && rustup default $nightly - name: Loom tests - run: cargo test --features loom + run: cargo test --tests --features loom coverage: name: coverage diff --git a/ci/miri.sh b/ci/miri.sh index 4389abe..ff9faef 100755 --- a/ci/miri.sh +++ b/ci/miri.sh @@ -3,9 +3,7 @@ set -e rustup toolchain install nightly --component miri rustup override set nightly -cargo miri setup export MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-disable-isolation -Zmiri-symbolic-alignment-check" -cargo hack miri test --tests --each-feature --exclude-no-default-features --exclude-all-features - +cargo miri test --tests diff --git a/ci/sanitizer.sh b/ci/sanitizer.sh index 2bab29d..26a1e5c 100755 --- a/ci/sanitizer.sh +++ b/ci/sanitizer.sh @@ -6,12 +6,12 @@ export ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" # Run address sanitizer with cargo-hack RUSTFLAGS="-Z sanitizer=address" \ -cargo hack test --tests --each-feature --exclude-no-default-features --exclude-all-features +cargo test # Run leak sanitizer with cargo-hack RUSTFLAGS="-Z sanitizer=leak" \ -cargo hack test --tests --each-feature --exclude-no-default-features --exclude-all-features +cargo test # Run thread sanitizer with cargo-hack RUSTFLAGS="-Z sanitizer=thread" \ -cargo hack -Zbuild-std test --tests --each-feature --exclude-no-default-features --exclude-all-features +cargo -Zbuild-std test