|
13 | 13 | RUSTDOCFLAGS: -Dwarnings
|
14 | 14 | RUSTFLAGS: -Dwarnings
|
15 | 15 | RUST_BACKTRACE: full
|
| 16 | + BENCHMARK_RUSTC: nightly-2025-01-16 # Pin the toolchain for reproducable results |
16 | 17 |
|
17 | 18 | jobs:
|
18 | 19 | test:
|
@@ -161,6 +162,55 @@ jobs:
|
161 | 162 | - uses: Swatinem/rust-cache@v2
|
162 | 163 | - run: cargo clippy -- -D clippy::all
|
163 | 164 |
|
| 165 | + benchmarks: |
| 166 | + name: Benchmarks |
| 167 | + runs-on: ubuntu-24.04 |
| 168 | + timeout-minutes: 20 |
| 169 | + steps: |
| 170 | + - uses: actions/checkout@master |
| 171 | + with: |
| 172 | + submodules: true |
| 173 | + - uses: taiki-e/install-action@cargo-binstall |
| 174 | + |
| 175 | + - name: Set up dependencies |
| 176 | + run: | |
| 177 | + sudo apt-get update |
| 178 | + sudo apt-get install -y valgrind gdb libc6-dbg # Needed for iai-callgrind |
| 179 | + rustup update "$BENCHMARK_RUSTC" --no-self-update |
| 180 | + rustup default "$BENCHMARK_RUSTC" |
| 181 | + # Install the version of iai-callgrind-runner that is specified in Cargo.toml |
| 182 | + iai_version="$(cargo metadata --format-version=1 --features icount | |
| 183 | + jq -r '.packages[] | select(.name == "iai-callgrind").version')" |
| 184 | + cargo binstall -y iai-callgrind-runner --version "$iai_version" |
| 185 | + sudo apt-get install valgrind |
| 186 | + - uses: Swatinem/rust-cache@v2 |
| 187 | + |
| 188 | + - name: Run icount benchmarks |
| 189 | + env: |
| 190 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 191 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 192 | + run: ./ci/bench-icount.sh |
| 193 | + |
| 194 | + - name: Upload the benchmark baseline |
| 195 | + uses: actions/upload-artifact@v4 |
| 196 | + with: |
| 197 | + name: ${{ env.BASELINE_NAME }} |
| 198 | + path: ${{ env.BASELINE_NAME }}.tar.xz |
| 199 | + |
| 200 | + - name: Run wall time benchmarks |
| 201 | + run: | |
| 202 | + # Always use the same seed for benchmarks. Ideally we should switch to a |
| 203 | + # non-random generator. |
| 204 | + export LIBM_SEED=benchesbenchesbenchesbencheswoo! |
| 205 | + cargo bench --package libm-test \ |
| 206 | + --no-default-features \ |
| 207 | + --features short-benchmarks,build-musl,libm/force-soft-floats |
| 208 | +
|
| 209 | + - name: Print test logs if available |
| 210 | + if: always() |
| 211 | + run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi |
| 212 | + shell: bash |
| 213 | + |
164 | 214 | miri:
|
165 | 215 | name: Miri
|
166 | 216 | runs-on: ubuntu-24.04
|
@@ -189,10 +239,11 @@ jobs:
|
189 | 239 |
|
190 | 240 | success:
|
191 | 241 | needs:
|
192 |
| - - test |
193 |
| - - rustfmt |
| 242 | + - benchmarks |
194 | 243 | - clippy
|
195 | 244 | - miri
|
| 245 | + - rustfmt |
| 246 | + - test |
196 | 247 | runs-on: ubuntu-24.04
|
197 | 248 | # GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
|
198 | 249 | # failed" as success. So we have to do some contortions to ensure the job fails if any of its
|
|
0 commit comments