Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 1eafc27

Browse files
authored
Merge pull request #445 from tgross35/ci-flexible-script
Make the CI script more flexible
2 parents dc3c73a + 6fb6eab commit 1eafc27

File tree

5 files changed

+34
-8
lines changed

5 files changed

+34
-8
lines changed

libm/.github/workflows/main.yml renamed to libm/.github/workflows/main.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77

88
env:
99
CARGO_TERM_COLOR: always
10-
CARGO_TERM_VERBOSE: true
1110
RUSTDOCFLAGS: -Dwarnings
1211
RUSTFLAGS: -Dwarnings
1312
RUST_BACKTRACE: full
@@ -202,7 +201,7 @@ jobs:
202201
- name: Fetch pull request ref
203202
run: git fetch origin "$GITHUB_REF:$GITHUB_REF"
204203
if: github.event_name == 'pull_request'
205-
- run: python3 ci/calculate-exhaustive-matrix.py >> "$GITHUB_OUTPUT"
204+
- run: python3 ci/ci-util.py generate-matrix >> "$GITHUB_OUTPUT"
206205
id: script
207206

208207
extensive:

libm/ci/calculate-exhaustive-matrix.py renamed to libm/ci/ci-util.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
#!/usr/bin/env python3
2-
"""Calculate which exhaustive tests should be run as part of CI.
2+
"""Utilities for CI.
33
44
This dynamically prepares a list of routines that had a source file change based on
55
git history.
66
"""
77

8+
import json
89
import subprocess as sp
910
import sys
10-
import json
1111
from dataclasses import dataclass
12+
from inspect import cleandoc
1213
from os import getenv
1314
from pathlib import Path
1415
from typing import TypedDict
1516

17+
USAGE = cleandoc(
18+
"""
19+
usage:
20+
21+
./ci/ci-util.py <SUBCOMMAND>
22+
23+
SUBCOMMAND:
24+
generate-matrix Calculate a matrix of which functions had source change,
25+
print that as JSON object.
26+
"""
27+
)
1628

1729
REPO_ROOT = Path(__file__).parent.parent
1830
GIT = ["git", "-C", REPO_ROOT]
@@ -139,9 +151,17 @@ def eprint(*args, **kwargs):
139151

140152

141153
def main():
142-
ctx = Context()
143-
output = ctx.make_workflow_output()
144-
print(f"matrix={output}")
154+
match sys.argv[1:]:
155+
case ["generate-matrix"]:
156+
ctx = Context()
157+
output = ctx.make_workflow_output()
158+
print(f"matrix={output}")
159+
case ["--help" | "-h"]:
160+
print(USAGE)
161+
exit()
162+
case _:
163+
eprint(USAGE)
164+
exit(1)
145165

146166

147167
if __name__ == "__main__":

libm/ci/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ if [ "$nextest" = "1" ]; then
9393
cfg_flag="--config-file $cfg_file"
9494
fi
9595

96-
cmd="cargo nextest run ${cfg_flag:-} $flags"
96+
cmd="cargo nextest run ${cfg_flag:-} --max-fail=10 $flags"
9797
profile="--cargo-profile"
9898
fi
9999

libm/crates/libm-test/src/precision.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,13 @@ impl MaybeOverride<(i32, f32)> for SpecialCase {
454454
XFAIL
455455
}
456456

457+
// `ynf(213, 109.15641) = -inf` with our library, should be finite.
458+
(_, BaseName::Yn)
459+
if input.0 > 200 && !expected.is_infinite() && actual.is_infinite() =>
460+
{
461+
XFAIL
462+
}
463+
457464
_ => None,
458465
}
459466
}

0 commit comments

Comments
 (0)