Skip to content

Commit 4fa8a68

Browse files
committed
ci: Add extensive tests from rust-lang/libm
1 parent 33ec3e8 commit 4fa8a68

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/main.yaml

+68
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,78 @@ jobs:
257257
run: rustup set profile minimal && rustup default stable && rustup component add rustfmt
258258
- run: cargo fmt -- --check
259259

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

0 commit comments

Comments
 (0)