MAINT: Run wheel build on PRs, too #74
Workflow file for this run
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: Wheels | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build_bdist: | |
name: "Build ${{ matrix.os }} (${{ matrix.arch }}) wheels" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
arch: ["x86_64", "arm64", "AMD64"] | |
exclude: | |
- os: ubuntu-latest | |
arch: arm64 | |
- os: ubuntu-latest | |
arch: AMD64 | |
- os: windows-latest | |
arch: arm64 | |
- os: windows-latest | |
arch: x86_64 | |
- os: macos-latest | |
arch: AMD64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" | |
uses: pypa/[email protected] | |
env: | |
# Skips pypy py36,37 | |
CIBW_SKIP: "pp* cp36-* cp37-*" | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_TEST_SKIP: "*_arm64" | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: > | |
python -c "import cftime; print(f'cftime v{cftime.__version__}')" && | |
python -m pip install check-manifest cython pytest pytest-cov && | |
python -m pytest -vv {package}/test | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pypi-artifacts | |
path: ${{ github.workspace }}/wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: > | |
pip install build | |
&& python -m build --sdist . --outdir dist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
show-artifacts: | |
needs: [build_bdist, build_sdist] | |
name: "Show artifacts" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: pypi-artifacts | |
path: ${{ github.workspace }}/dist | |
- shell: bash | |
run: | | |
ls -l ${{ github.workspace }}/dist | |
publish-artifacts-pypi: | |
needs: [build_bdist, build_sdist] | |
name: "Publish to PyPI" | |
runs-on: ubuntu-latest | |
# 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@v3 | |
with: | |
name: pypi-artifacts | |
path: ${{ github.workspace }}/dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} | |
print_hash: true |