name: Wheels on: pull_request: branches: - master release: types: - published 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-24.04 arch: x86_64 - os: ubuntu-24.04-arm arch: aarch64 - os: windows-2022 arch: AMD64 - os: macos-14 arch: arm64 - os: macos-15-intel arch: x86_64 - os: windows-11-arm arch: ARM64 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 persist-credentials: false - name: Build just oldest and newest on PRs, all on tags if: ${{ github.event_name == 'pull_request' }} shell: bash # - On PPs, omit musllinux for speed # - On PRs, run just oldest and newest Python versions (3.11 is the oldest abi3 target) run: | CIBW_SKIP="cp310-win_arm64 *musllinux*" echo "CIBW_SKIP=$CIBW_SKIP" >> $GITHUB_ENV echo "Setting CIBW_SKIP=$CIBW_SKIP" CIBW_TEST_SKIP="cp312-* cp313-*" echo "CIBW_TEST_SKIP=$CIBW_TEST_SKIP" >> $GITHUB_ENV echo "Setting CIBW_TEST_SKIP=$CIBW_TEST_SKIP" - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 env: CIBW_SKIP: ${{ env.CIBW_SKIP }} CIBW_TEST_SKIP: ${{ env.CIBW_TEST_SKIP }} CIBW_ARCHS: ${{ matrix.arch }} - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: pypi-artifacts-${{ matrix.os }}-${{ matrix.arch }} path: ${{ github.workspace }}/wheelhouse/*.whl permissions: actions: write build_sdist: name: Build source distribution runs-on: ubuntu-24.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 persist-credentials: false - name: Build sdist run: > pip install build && python -m build --sdist . --outdir dist - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: pypi-artifacts path: ${{ github.workspace }}/dist/*.tar.gz permissions: actions: write publish-artifacts-pypi: needs: [build_bdist, build_sdist] name: "Publish to PyPI" runs-on: ubuntu-24.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@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: pattern: pypi-artifacts* path: ${{ github.workspace }}/dist merge-multiple: true # Move to Trusted Publishing - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 with: print_hash: true environment: name: release url: https://pypi.org/p/cftime permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing