Just use macos-latest for all but pinned versions #773
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push, pull_request] | |
jobs: | |
test-linux: | |
name: "Run tests on Linux" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: ["3.12", "3.11", "3.10"] | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Run Tests (Linux) | |
run: | | |
python -m pip install --upgrade pip setuptools wheel meson ninja meson-python cython numpy | |
python -m pip install --no-build-isolation --editable '.[test]' | |
pytest --cov --cov-report html --cov-report xml --cov-report annotate -s | |
- uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
verbose: true # optional (default = false) | |
test-macos: | |
name: "Run tests on MacOS" | |
runs-on: macos-latest | |
env: | |
#LDFLAGS: "-ld64" # For MacOS 13 and above (XCode CLT 15 and above.) | |
CC: gcc-14 | |
CXX: gcc-14 | |
FC: gfortran-14 | |
DUCC0_NUM_THREADS: 2 | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: "3.11" | |
- name: Install Dependencies (MacOS) | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install numpy "Cython<3.0.4" | |
- name: Install Package (MacOS) | |
# The built-in fortran compiler does not link to gfortran (just numbered versions) | |
# and build_ext does not play nicely with that. So we link gfortran-X to gfortran. | |
run: | | |
ln -s $FC $(dirname $(which $FC))/gfortran | |
echo "Using FC=$FC CXX=$CXX CC=$CC" | |
python -m pip install . | |
- name: Run Tests (MacOS) | |
run: | | |
pytest -s | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# macos-13 is an intel runner, macos-14 is apple silicon | |
os: [ubuntu-latest, macos-13] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
FC: gfortran-12 | |
CC: gcc-12 | |
MACOSX_DEPLOYMENT_TARGET: "13.0" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
build_wheels_macos_arm: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# macos-13 is an intel runner, macos-14 is apple silicon | |
os: [macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
FC: gfortran-12 | |
CC: gcc-12 | |
MACOSX_DEPLOYMENT_TARGET: "14.0" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
name: Install Python | |
with: | |
python-version: '3.10' | |
- name: Build sdist | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U setuptools | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install "Cython<3.0.4" | |
python -m pip install numpy | |
python -m pip install build | |
python -m build . --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist, build_wheels_macos_arm] | |
runs-on: ubuntu-latest | |
# upload to PyPI on every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
# alternatively, to publish when a GitHub Release is created, use the following rule: | |
# if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
# To test: repository_url: https://test.pypi.org/legacy/ | |
# Automatically upload builds to PyPI test when all tests pass. | |
# Requires some thought about versioning before activating. | |
# upload_pypi_test: | |
# needs: [build_wheels_linux, build_wheels_macos, build_sdist] | |
# runs-on: ubuntu-latest | |
# environment: | |
# name: testpypi | |
# url: https://test.pypi.org/p/pixell | |
# # Upload to pypi testing on every successful test run and build generation | |
# steps: | |
# - uses: actions/download-artifact@v2 | |
# with: | |
# name: artifact | |
# path: dist | |
# - uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# repository-url: https://test.pypi.org/legacy/ | |
# user: __token__ | |
# password: ${{ secrets.PYPI_TEST_TOKEN }} |