feat: 3153 #473
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
permissions: | |
contents: read | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
name: Safety | |
jobs: | |
sanitizers: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
submodules: true | |
- name: Install nightly | |
uses: dtolnay/rust-toolchain@655bc29a221a62ee6edb6a0fa9d9530cf424d31d # nightly | |
- run: | | |
# to get the symbolizer for debug symbol resolution | |
sudo apt install llvm | |
# to fix buggy leak analyzer: | |
# https://github.com/japaric/rust-san#unrealiable-leaksanitizer | |
sed -i '/\[features\]/i [profile.dev]' Cargo.toml | |
sed -i '/profile.dev/a opt-level = 1' Cargo.toml | |
cat Cargo.toml | |
name: Enable debug symbols | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: cargo +nightly test -Zsanitizer=address | |
# only --lib --tests b/c of https://github.com/rust-lang/rust/issues/53945 | |
run: cargo +nightly test --lib --tests --all-features --target x86_64-unknown-linux-gnu | |
env: | |
ASAN_OPTIONS: "detect_odr_violation=0:detect_leaks=0" | |
RUSTFLAGS: "-Z sanitizer=address" | |
- name: cargo test -Zsanitizer=leak | |
if: always() | |
run: cargo +nightly test --all-features --target x86_64-unknown-linux-gnu | |
env: | |
LSAN_OPTIONS: "suppressions=lsan-suppressions.txt" | |
RUSTFLAGS: "-Z sanitizer=leak" | |
miri: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
submodules: true | |
- run: | | |
echo "NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)" >> $GITHUB_ENV | |
- name: Install ${{ env.NIGHTLY }} | |
uses: dtolnay/rust-toolchain@e12eda571dc9a5ee5d58eecf4738ec291c66f295 # master | |
with: | |
toolchain: ${{ env.NIGHTLY }} | |
components: miri | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: cargo miri test | |
run: MIRIFLAGS="-Zmiri-disable-isolation" cargo +${{ env.NIGHTLY }} miri test | |
env: | |
MIRIFLAGS: "" | |
# loom: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# with: | |
# submodules: true | |
# - name: Install stable | |
# uses: dtolnay/rust-toolchain@stable | |
# - name: cargo test --test loom | |
# run: cargo test --release --test loom | |
# env: | |
# LOOM_MAX_PREEMPTIONS: 2 | |
# RUSTFLAGS: "--cfg loom" |