Skip to content

Commit be2fde2

Browse files
ci: Add Apple silicon macOS to CI (#2447)
* Add Apple M1 runner to tests using 'macos-14' for the 'runs-on' key. - c.f. https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/ * Lower the tolerance for tests/test_calculator.py to reach agreement between amd64 and arm64. * Skip doctest evaluation for arm64.
1 parent c09738d commit be2fde2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
include:
3232
- os: macos-latest
3333
python-version: '3.11'
34+
# Apple silicon runner
35+
- os: macos-14
36+
python-version: '3.11'
3437

3538
steps:
3639
- uses: actions/checkout@v4
@@ -92,11 +95,12 @@ jobs:
9295
token: ${{ secrets.CODECOV_TOKEN }}
9396

9497
- name: Test docstring examples with doctest
95-
if: matrix.python-version == '3.11'
98+
# TODO: Don't currently try to match amd64 and arm64 floating point for docs, but will in the future.
99+
if: matrix.python-version == '3.11' && matrix.os != 'macos-14'
96100
run: coverage run --data-file=.coverage-doctest --module pytest src/ README.rst
97101

98102
- name: Coverage report for doctest only
99-
if: matrix.python-version == '3.11'
103+
if: matrix.python-version == '3.11' && matrix.os != 'macos-14'
100104
run: |
101105
coverage report --data-file=.coverage-doctest
102106
coverage xml --data-file=.coverage-doctest -o doctest-coverage.xml

tests/test_calculator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def test_asymptotic_calculator_has_fitted_pars(test_stat):
8484
assert pytest.approx([1.0, 1.0], rel=rtol) == pyhf.tensorlib.tolist(
8585
fitted_pars.free_fit_to_data
8686
)
87+
# lower tolerance for amd64 and arm64 to agree
8788
assert pytest.approx(
88-
[7.6470499e-05, 1.4997178], rel=rtol
89+
[7.6470499e-05, 1.4997178], rel=1e-3
8990
) == pyhf.tensorlib.tolist(fitted_pars.free_fit_to_asimov)

0 commit comments

Comments
 (0)