| 1 |
name: Wheels |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
push: |
| 8 |
tags: |
| 9 |
- "v*" |
| 10 |
|
| 11 |
jobs: |
| 12 |
build_bdist: |
| 13 |
name: "Build ${{ matrix.os }} (${{ matrix.arch }}) wheels" |
| 14 |
runs-on: ${{ matrix.os }} |
| 15 |
timeout-minutes: 60 |
| 16 |
strategy: |
| 17 |
fail-fast: false |
| 18 |
matrix: |
| 19 |
include: |
| 20 |
- os: ubuntu-22.04 |
| 21 |
arch: x86_64 |
| 22 |
- os: ubuntu-22.04 |
| 23 |
arch: aarch64 |
| 24 |
- os: windows-2022 |
| 25 |
arch: AMD64 |
| 26 |
- os: macos-14 |
| 27 |
arch: arm64 |
| 28 |
- os: macos-13 |
| 29 |
arch: x86_64 |
| 30 |
|
| 31 |
steps: |
| 32 |
- uses: actions/checkout@v5 |
| 33 |
with: |
| 34 |
fetch-depth: 0 |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
- uses: docker/setup-qemu-action@v3 |
| 39 |
with: |
| 40 |
platforms: all |
| 41 |
if: runner.os == 'Linux' && matrix.arch == 'aarch64' |
| 42 |
|
| 43 |
- name: Build just oldest and newest on PRs, all on tags |
| 44 |
shell: bash |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
run: | |
| 50 |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then |
| 51 |
CIBW_SKIP="cp311-* cp312-* cp313-* cp314t-* *musllinux*" |
| 52 |
else |
| 53 |
CIBW_SKIP="cp314t-* *musllinux_aarch64" |
| 54 |
fi |
| 55 |
echo "CIBW_SKIP=$CIBW_SKIP" >> $GITHUB_ENV |
| 56 |
echo "Setting CIBW_SKIP=$CIBW_SKIP" |
| 57 |
|
| 58 |
- name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" |
| 59 |
uses: pypa/[email protected] |
| 60 |
env: |
| 61 |
CIBW_SKIP: ${{ env.CIBW_SKIP }} |
| 62 |
CIBW_ARCHS: ${{ matrix.arch }} |
| 63 |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 |
| 64 |
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 |
| 65 |
|
| 66 |
|
| 67 |
CIBW_TEST_SKIP: "cp3{10,11,12,13}-*_aarch64" |
| 68 |
CIBW_TEST_GROUPS: dev |
| 69 |
CIBW_TEST_COMMAND: > |
| 70 |
python -c "import cftime; print(f'cftime v{cftime.__version__}')" && |
| 71 |
python -m pytest -vv {package}/test |
| 72 |
|
| 73 |
- uses: actions/upload-artifact@v4 |
| 74 |
with: |
| 75 |
name: pypi-artifacts-${{ matrix.os }}-${{ matrix.arch }} |
| 76 |
path: ${{ github.workspace }}/wheelhouse/*.whl |
| 77 |
|
| 78 |
|
| 79 |
build_sdist: |
| 80 |
name: Build source distribution |
| 81 |
runs-on: ubuntu-22.04 |
| 82 |
steps: |
| 83 |
- uses: actions/checkout@v5 |
| 84 |
with: |
| 85 |
fetch-depth: 0 |
| 86 |
|
| 87 |
- name: Build sdist |
| 88 |
run: > |
| 89 |
pip install build |
| 90 |
&& python -m build --sdist . --outdir dist |
| 91 |
|
| 92 |
- uses: actions/upload-artifact@v4 |
| 93 |
with: |
| 94 |
name: pypi-artifacts |
| 95 |
path: ${{ github.workspace }}/dist/*.tar.gz |
| 96 |
|
| 97 |
show-artifacts: |
| 98 |
needs: [build_bdist, build_sdist] |
| 99 |
name: "Show artifacts" |
| 100 |
runs-on: ubuntu-22.04 |
| 101 |
steps: |
| 102 |
- uses: actions/download-artifact@v5 |
| 103 |
with: |
| 104 |
pattern: pypi-artifacts* |
| 105 |
path: ${{ github.workspace }}/dist |
| 106 |
merge-multiple: true |
| 107 |
|
| 108 |
- shell: bash |
| 109 |
run: | |
| 110 |
ls -l ${{ github.workspace }}/dist |
| 111 |
|
| 112 |
|
| 113 |
publish-artifacts-pypi: |
| 114 |
needs: [build_bdist, build_sdist] |
| 115 |
name: "Publish to PyPI" |
| 116 |
runs-on: ubuntu-22.04 |
| 117 |
|
| 118 |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') |
| 119 |
steps: |
| 120 |
- uses: actions/download-artifact@v5 |
| 121 |
with: |
| 122 |
pattern: pypi-artifacts* |
| 123 |
path: ${{ github.workspace }}/dist |
| 124 |
merge-multiple: true |
| 125 |
|
| 126 |
- uses: pypa/gh-action-pypi-publish@release/v1 |
| 127 |
with: |
| 128 |
user: __token__ |
| 129 |
password: ${{ secrets.PYPI_PASSWORD }} |
| 130 |
print_hash: true |