|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: [main] |
| 4 | + pull_request: |
| 5 | +name: safety |
| 6 | +jobs: |
| 7 | + sanitizers: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v3 |
| 11 | + with: |
| 12 | + submodules: true |
| 13 | + - name: Install nightly |
| 14 | + uses: actions-rs/toolchain@v1 |
| 15 | + with: |
| 16 | + profile: minimal |
| 17 | + toolchain: nightly |
| 18 | + default: true |
| 19 | + - run: | |
| 20 | + # to get the symbolizer for debug symbol resolution |
| 21 | + sudo apt install llvm |
| 22 | + # to fix buggy leak analyzer: |
| 23 | + # https://github.com/japaric/rust-san#unrealiable-leaksanitizer |
| 24 | + sed -i '/\[features\]/i [profile.dev]' Cargo.toml |
| 25 | + sed -i '/profile.dev/a opt-level = 1' Cargo.toml |
| 26 | + cat Cargo.toml |
| 27 | + name: Enable debug symbols |
| 28 | + - name: cargo test -Zsanitizer=address |
| 29 | + uses: actions-rs/cargo@v1 |
| 30 | + with: |
| 31 | + command: test |
| 32 | + # only --lib --tests b/c of https://github.com/rust-lang/rust/issues/53945 |
| 33 | + args: --lib --tests --all-features --target x86_64-unknown-linux-gnu |
| 34 | + env: |
| 35 | + ASAN_OPTIONS: "detect_odr_violation=0:detect_leaks=0" |
| 36 | + RUSTFLAGS: "-Z sanitizer=address" |
| 37 | + - name: cargo test -Zsanitizer=leak |
| 38 | + if: always() |
| 39 | + uses: actions-rs/cargo@v1 |
| 40 | + with: |
| 41 | + command: test |
| 42 | + args: --all-features --target x86_64-unknown-linux-gnu |
| 43 | + env: |
| 44 | + LSAN_OPTIONS: "suppressions=lsan-suppressions.txt" |
| 45 | + RUSTFLAGS: "-Z sanitizer=leak" |
| 46 | + miri: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v3 |
| 50 | + with: |
| 51 | + submodules: true |
| 52 | + - run: | |
| 53 | + echo "NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)" >> $GITHUB_ENV |
| 54 | + - name: Install ${{ env.NIGHTLY }} |
| 55 | + uses: actions-rs/toolchain@v1 |
| 56 | + with: |
| 57 | + profile: minimal |
| 58 | + toolchain: ${{ env.NIGHTLY }} |
| 59 | + default: true |
| 60 | + components: miri |
| 61 | + - name: cargo miri test |
| 62 | + uses: actions-rs/cargo@v1 |
| 63 | + with: |
| 64 | + command: miri |
| 65 | + args: test |
| 66 | + env: |
| 67 | + MIRIFLAGS: "-Zmiri-tag-raw-pointers" |
| 68 | + loom: |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v3 |
| 72 | + with: |
| 73 | + submodules: true |
| 74 | + - name: Install stable |
| 75 | + uses: actions-rs/toolchain@v1 |
| 76 | + with: |
| 77 | + toolchain: stable |
| 78 | + profile: minimal |
| 79 | + - name: cargo test --test loom |
| 80 | + uses: actions-rs/cargo@v1 |
| 81 | + with: |
| 82 | + command: test |
| 83 | + args: --release --test loom |
| 84 | + env: |
| 85 | + LOOM_MAX_PREEMPTIONS: 2 |
| 86 | + RUSTFLAGS: "--cfg loom" |
0 commit comments