MNT: unify static configuration files into pyproject.toml
, update PEP 639 license metadata
#133
Workflow file for this run
This file contains hidden or 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: Wheels | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build_bdist: | |
name: "Build ${{ matrix.os }} (${{ matrix.arch }}) wheels" | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 60 # should be long enough even on tags, but let's prevent hangs | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
arch: x86_64 | |
- os: ubuntu-22.04 | |
arch: aarch64 | |
- os: windows-2022 | |
arch: AMD64 | |
- os: macos-14 | |
arch: arm64 | |
- os: macos-13 | |
arch: x86_64 | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
# For aarch64 support | |
# https://cibuildwheel.pypa.io/en/stable/faq/#emulation | |
- uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
if: runner.os == 'Linux' && matrix.arch == 'aarch64' | |
- name: Build just oldest and newest on PRs, all on tags | |
shell: bash | |
# - Always omit musl 3.8 b/c NumPy does not provide wheels for it | |
# - Always omit musllinux_aarch64 because it's slow and niche | |
# - On PPs, omit musllinux for speed | |
# - On PRs, run just oldest and newest Python versions (and omit 3.8 aarch64) | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
CIBW_SKIP="cp38-* cp39-* cp310-* cp311-* cp38-*_aarch64 *musllinux*" | |
else | |
CIBW_SKIP="cp38-* *musllinux_aarch64" | |
fi | |
echo "CIBW_SKIP=$CIBW_SKIP" >> $GITHUB_ENV | |
echo "Setting CIBW_SKIP=$CIBW_SKIP" | |
- name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" | |
uses: pypa/[email protected] | |
env: | |
CIBW_SKIP: ${{ env.CIBW_SKIP }} | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 | |
# Emulated testing is slow, so trust that the Python 3.12 test is good enough on aarch64 | |
# (takes about 5 minutes per wheel to build, and 5 minutes to test) | |
CIBW_TEST_SKIP: "cp39-*_aarch64 cp310-*_aarch64 cp311-*_aarch64" | |
CIBW_TEST_GROUPS: dev | |
CIBW_TEST_COMMAND: > | |
python -c "import cftime; print(f'cftime v{cftime.__version__}')" && | |
python -m pytest -vv {package}/test | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pypi-artifacts-${{ matrix.os }}-${{ matrix.arch }} | |
path: ${{ github.workspace }}/wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Build sdist | |
run: > | |
pip install build | |
&& python -m build --sdist . --outdir dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pypi-artifacts | |
path: ${{ github.workspace }}/dist/*.tar.gz | |
show-artifacts: | |
needs: [build_bdist, build_sdist] | |
name: "Show artifacts" | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/download-artifact@v5 | |
with: | |
pattern: pypi-artifacts* | |
path: ${{ github.workspace }}/dist | |
merge-multiple: true | |
- shell: bash | |
run: | | |
ls -l ${{ github.workspace }}/dist | |
publish-artifacts-pypi: | |
needs: [build_bdist, build_sdist] | |
name: "Publish to PyPI" | |
runs-on: ubuntu-22.04 | |
# upload to PyPI for every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v5 | |
with: | |
pattern: pypi-artifacts* | |
path: ${{ github.workspace }}/dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} | |
print_hash: true |