|
| 1 | +name: Sanitizers |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + paths-ignore: |
| 7 | + - "**.md" |
| 8 | + - "docs/**" |
| 9 | + - "LICENSE*" |
| 10 | + - ".gitignore" |
| 11 | + pull_request: |
| 12 | + branches: [master] |
| 13 | + paths-ignore: |
| 14 | + - "**.md" |
| 15 | + - "docs/**" |
| 16 | + - "LICENSE*" |
| 17 | + - ".gitignore" |
| 18 | + workflow_dispatch: |
| 19 | + |
| 20 | +jobs: |
| 21 | + asan: |
| 22 | + name: AddressSanitizer (macOS) |
| 23 | + runs-on: macOS-latest |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v5 |
| 26 | + |
| 27 | + - name: Install dependencies |
| 28 | + run: brew install llvm |
| 29 | + |
| 30 | + - name: Install nightly Rust with rust-src |
| 31 | + uses: dtolnay/rust-toolchain@nightly |
| 32 | + with: |
| 33 | + components: rust-src |
| 34 | + |
| 35 | + - name: Rust Cache |
| 36 | + uses: Swatinem/rust-cache@v2 |
| 37 | + with: |
| 38 | + key: asan-macos |
| 39 | + |
| 40 | + - name: Run tests with AddressSanitizer |
| 41 | + env: |
| 42 | + RUSTFLAGS: -Zsanitizer=address |
| 43 | + RUSTDOCFLAGS: -Zsanitizer=address |
| 44 | + run: | |
| 45 | + cargo +nightly test \ |
| 46 | + -Zbuild-std \ |
| 47 | + --target aarch64-apple-darwin \ |
| 48 | + --lib \ |
| 49 | + --verbose |
| 50 | +
|
| 51 | + - name: Upload ASAN logs |
| 52 | + if: failure() |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: asan-logs-macos |
| 56 | + path: | |
| 57 | + asan.log.* |
| 58 | + /tmp/asan.* |
| 59 | + if-no-files-found: ignore |
| 60 | + |
| 61 | + tsan: |
| 62 | + name: ThreadSanitizer (macOS) |
| 63 | + runs-on: macOS-latest |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v5 |
| 66 | + |
| 67 | + - name: Install dependencies |
| 68 | + run: brew install llvm |
| 69 | + |
| 70 | + - name: Install nightly Rust with rust-src |
| 71 | + uses: dtolnay/rust-toolchain@nightly |
| 72 | + with: |
| 73 | + components: rust-src |
| 74 | + |
| 75 | + - name: Rust Cache |
| 76 | + uses: Swatinem/rust-cache@v2 |
| 77 | + with: |
| 78 | + key: tsan-macos |
| 79 | + |
| 80 | + - name: Run tests with ThreadSanitizer |
| 81 | + env: |
| 82 | + RUSTFLAGS: -Zsanitizer=thread |
| 83 | + RUSTDOCFLAGS: -Zsanitizer=thread |
| 84 | + TSAN_OPTIONS: second_deadlock_stack=1 |
| 85 | + run: | |
| 86 | + cargo +nightly test \ |
| 87 | + -Zbuild-std \ |
| 88 | + --target aarch64-apple-darwin \ |
| 89 | + --lib \ |
| 90 | + --verbose |
| 91 | +
|
| 92 | + - name: Upload TSAN logs |
| 93 | + if: failure() |
| 94 | + uses: actions/upload-artifact@v4 |
| 95 | + with: |
| 96 | + name: tsan-logs-macos |
| 97 | + path: | |
| 98 | + tsan.log.* |
| 99 | + /tmp/tsan.* |
| 100 | + if-no-files-found: ignore |
| 101 | + |
| 102 | + asan-linux: |
| 103 | + name: AddressSanitizer (Linux) |
| 104 | + runs-on: ubuntu-latest |
| 105 | + steps: |
| 106 | + - uses: actions/checkout@v5 |
| 107 | + |
| 108 | + - name: Cache Linux audio packages |
| 109 | + uses: awalsh128/cache-apt-pkgs-action@latest |
| 110 | + with: |
| 111 | + packages: libasound2-dev libjack-jackd2-dev libjack-jackd2-0 libdbus-1-dev |
| 112 | + |
| 113 | + - name: Install nightly Rust with rust-src |
| 114 | + uses: dtolnay/rust-toolchain@nightly |
| 115 | + with: |
| 116 | + components: rust-src |
| 117 | + |
| 118 | + - name: Rust Cache |
| 119 | + uses: Swatinem/rust-cache@v2 |
| 120 | + with: |
| 121 | + key: asan-linux |
| 122 | + |
| 123 | + - name: Run tests with AddressSanitizer |
| 124 | + env: |
| 125 | + RUSTFLAGS: -Zsanitizer=address |
| 126 | + RUSTDOCFLAGS: -Zsanitizer=address |
| 127 | + run: | |
| 128 | + cargo +nightly test \ |
| 129 | + -Zbuild-std \ |
| 130 | + --target x86_64-unknown-linux-gnu \ |
| 131 | + --lib \ |
| 132 | + --verbose |
| 133 | +
|
| 134 | + - name: Upload ASAN logs |
| 135 | + if: failure() |
| 136 | + uses: actions/upload-artifact@v4 |
| 137 | + with: |
| 138 | + name: asan-logs-linux |
| 139 | + path: | |
| 140 | + asan.log.* |
| 141 | + /tmp/asan.* |
| 142 | + if-no-files-found: ignore |
| 143 | + |
| 144 | + tsan-linux: |
| 145 | + name: ThreadSanitizer (Linux) |
| 146 | + runs-on: ubuntu-latest |
| 147 | + steps: |
| 148 | + - uses: actions/checkout@v5 |
| 149 | + |
| 150 | + - name: Cache Linux audio packages |
| 151 | + uses: awalsh128/cache-apt-pkgs-action@latest |
| 152 | + with: |
| 153 | + packages: libasound2-dev libjack-jackd2-dev libjack-jackd2-0 libdbus-1-dev |
| 154 | + |
| 155 | + - name: Install nightly Rust with rust-src |
| 156 | + uses: dtolnay/rust-toolchain@nightly |
| 157 | + with: |
| 158 | + components: rust-src |
| 159 | + |
| 160 | + - name: Rust Cache |
| 161 | + uses: Swatinem/rust-cache@v2 |
| 162 | + with: |
| 163 | + key: tsan-linux |
| 164 | + |
| 165 | + - name: Run tests with ThreadSanitizer |
| 166 | + env: |
| 167 | + RUSTFLAGS: -Zsanitizer=thread |
| 168 | + RUSTDOCFLAGS: -Zsanitizer=thread |
| 169 | + TSAN_OPTIONS: second_deadlock_stack=1 |
| 170 | + run: | |
| 171 | + cargo +nightly test \ |
| 172 | + -Zbuild-std \ |
| 173 | + --target x86_64-unknown-linux-gnu \ |
| 174 | + --lib \ |
| 175 | + --verbose |
| 176 | +
|
| 177 | + - name: Upload TSAN logs |
| 178 | + if: failure() |
| 179 | + uses: actions/upload-artifact@v4 |
| 180 | + with: |
| 181 | + name: tsan-logs-linux |
| 182 | + path: | |
| 183 | + tsan.log.* |
| 184 | + /tmp/tsan.* |
| 185 | + if-no-files-found: ignore |
0 commit comments