Skip to content

Commit

Permalink
ci: Add Apple silicon macOS to CI (#2447)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
matthewfeickert authored Mar 12, 2024
1 parent c09738d commit be2fde2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
include:
- os: macos-latest
python-version: '3.11'
# Apple silicon runner
- os: macos-14
python-version: '3.11'

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -92,11 +95,12 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

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

- name: Coverage report for doctest only
if: matrix.python-version == '3.11'
if: matrix.python-version == '3.11' && matrix.os != 'macos-14'
run: |
coverage report --data-file=.coverage-doctest
coverage xml --data-file=.coverage-doctest -o doctest-coverage.xml
Expand Down
3 changes: 2 additions & 1 deletion tests/test_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def test_asymptotic_calculator_has_fitted_pars(test_stat):
assert pytest.approx([1.0, 1.0], rel=rtol) == pyhf.tensorlib.tolist(
fitted_pars.free_fit_to_data
)
# lower tolerance for amd64 and arm64 to agree
assert pytest.approx(
[7.6470499e-05, 1.4997178], rel=rtol
[7.6470499e-05, 1.4997178], rel=1e-3
) == pyhf.tensorlib.tolist(fitted_pars.free_fit_to_asimov)

0 comments on commit be2fde2

Please sign in to comment.