Skip to content

Commit

Permalink
Cleanup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed May 24, 2024
1 parent 1ea7ba7 commit 2431c3f
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 12 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 2 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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

Expand All @@ -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:
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions ci/miri.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions ci/sanitizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2431c3f

Please sign in to comment.