Skip to content

Commit

Permalink
Add weekly sanitizer run to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ilai-deutel committed Nov 18, 2024
1 parent cf2dc81 commit b138c10
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ jobs:
sudo apt-get update
sudo apt-get install gcc-multilib
- name: Install Rust toolchain
run: |
rustup toolchain install ${{ matrix.toolchain || 'stable' }}
rustup override set ${{ matrix.toolchain || 'stable' }}
rustup target add --toolchain ${{ matrix.toolchain || 'stable' }} ${{ matrix.target }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain || 'stable' }}
targets: ${{ matrix.target }}
- name: Build
run: cargo build
- name: Run tests
Expand Down Expand Up @@ -163,10 +163,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install nightly with clippy and rustfmt
run: |
rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade
rustup override set nightly
rustup target add --toolchain nightly ${{ matrix.target }}
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}
components: rustfmt, clippy
- name: Format
if: ${{ github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu' }}
uses: mbrobbel/rustfmt-check@master
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Sanitizers

on:
pull_request:
branches:
- master
paths:
- '.github/workflows/sanitizers.yml'
schedule:
- cron: '12 07 * * 2' # weekly on Tuesday

jobs:
sanitizers:
strategy:
matrix:
sanitizer:
- address
- leak
- memory
- safestack
- thread
target:
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
- wasm32-wasip1
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- sanitizer: memory
extra_flags: -Zsanitizer-memory-track-origins
exclude:
# LeakSanitizer is not supported on MacOS
- sanitizer: leak
target: x86_64-apple-darwin
- sanitizer: leak
target: wasm32-wasip1
# MemorySanitizer is not supported on MacOS
- sanitizer: memory
target: x86_64-apple-darwin
# Safestack is not supported on MacOS
- sanitizer: safestack
target: x86_64-apple-darwin


runs-on: ${{ matrix.os }}
continue-on-error: true

steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}
components: rust-src
- name: Run tests with sanitizer
run: cargo test -Zbuild-std --verbose --all-features --no-fail-fast --target ${{ matrix.target }}
env:
RUSTFLAGS: -D warnings -Zsanitizer=${{ matrix.sanitizer }} ${{ matrix.extra_flags }}
RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }} ${{ matrix.extra_flags }}

0 comments on commit b138c10

Please sign in to comment.