Skip to content

Commit 23d2383

Browse files
committed
ci: Add extensive tests from rust-lang/libm
1 parent 98cdc8e commit 23d2383

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/main.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,78 @@ jobs:
237237
run: rustup set profile minimal && rustup default stable && rustup component add rustfmt
238238
- run: cargo fmt -- --check
239239

240+
# Determine which extensive tests should be run based on changed files.
241+
calculate_extensive_matrix:
242+
name: Calculate job matrix
243+
runs-on: ubuntu-24.04
244+
timeout-minutes: 10
245+
env:
246+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
247+
PR_NUMBER: ${{ github.event.pull_request.number }}
248+
outputs:
249+
matrix: ${{ steps.script.outputs.matrix }}
250+
steps:
251+
- uses: actions/checkout@v4
252+
with:
253+
fetch-depth: 100
254+
- name: Fetch pull request ref
255+
run: git fetch origin "$GITHUB_REF:$GITHUB_REF"
256+
if: github.event_name == 'pull_request'
257+
- run: python3 ci/ci-util.py generate-matrix >> "$GITHUB_OUTPUT"
258+
id: script
259+
260+
extensive:
261+
name: Extensive tests for ${{ matrix.ty }}
262+
needs:
263+
# Wait on `clippy` so we have some confidence that the crate will build
264+
- clippy
265+
- calculate_extensive_matrix
266+
runs-on: ubuntu-24.04
267+
timeout-minutes: 240 # 4 hours
268+
strategy:
269+
matrix:
270+
# Use the output from `calculate_extensive_matrix` to calculate the matrix
271+
# FIXME: it would be better to run all jobs (i.e. all types) but mark those that
272+
# didn't change as skipped, rather than completely excluding the job. However,
273+
# this is not currently possible https://github.com/actions/runner/issues/1985.
274+
include: ${{ fromJSON(needs.calculate_extensive_matrix.outputs.matrix).matrix }}
275+
env:
276+
TO_TEST: ${{ matrix.to_test }}
277+
steps:
278+
- uses: actions/checkout@v4
279+
with:
280+
submodules: true
281+
- name: Install Rust
282+
run: |
283+
rustup update nightly --no-self-update
284+
rustup default nightly
285+
- uses: Swatinem/rust-cache@v2
286+
- name: Run extensive tests
287+
run: |
288+
echo "Tests to run: '$TO_TEST'"
289+
if [ -z "$TO_TEST" ]; then
290+
echo "No tests to run, exiting."
291+
exit
292+
fi
293+
294+
set -x
295+
296+
# Run the non-extensive tests first to catch any easy failures
297+
cargo t --profile release-checked -- "$TO_TEST"
298+
299+
LIBM_EXTENSIVE_TESTS="$TO_TEST" cargo test \
300+
--features build-mpfr,unstable,force-soft-floats \
301+
--profile release-checked \
302+
-- extensive
303+
- name: Print test logs if available
304+
run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi
305+
shell: bash
306+
240307
success:
241308
needs:
242309
- benchmarks
243310
- clippy
311+
- extensive
244312
- miri
245313
- rustfmt
246314
- test

0 commit comments

Comments
 (0)