Switch to cibuildwheel for wheel building #556
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: Deploy sdist and wheels | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency | |
# https://docs.github.com/en/developers/webhooks-and-events/events/github-event-types#pullrequestevent | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.type }} | |
cancel-in-progress: true | |
on: | |
push: | |
pull_request: | |
release: | |
types: | |
- published | |
jobs: | |
build_sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Create sdist | |
shell: bash -l {0} | |
run: | | |
python -m pip install -q build | |
python -m build -s | |
- name: Upload sdist to build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sdist | |
path: dist/*.tar.gz | |
build_wheels: | |
name: "Build wheels on ${{ matrix.os }}" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-2019, macos-11, ubuntu-20.04] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
git fetch --prune --unshallow | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_SKIP: "cp36-* cp37-* cp38-* pp* *-manylinux_i686 *-musllinux*" | |
CIBW_ARCHS: auto64 | |
CIBW_TEST_COMMAND: "python -c \"import pyresample; assert 'unknown' not in pyresample.__version__, 'incorrect version found'\"" | |
# | |
# | |
# - name: Install dependencies | |
# run: | | |
# python -m pip install -U -q pip Cython wheel setuptools twine numpy build | |
# | |
# - name: Build and install macOS/Windows wheel | |
# if: matrix.os != 'ubuntu-latest' | |
# run: | | |
# python -m build -w | |
# pip install --find-links=./dist/ pyresample | |
# | |
# - name: Build Linux wheels inside docker | |
# if: matrix.os == 'ubuntu-latest' | |
# run: | | |
# docker run \ | |
# -e PLAT=${{ matrix.docker-image }} \ | |
# -e USE_OMP=1 \ | |
# -v `pwd`:/io \ | |
# quay.io/pypa/${{ matrix.docker-image }} \ | |
# /io/continuous_integration/build-manylinux-wheels.sh | |
# | |
# - name: Check version number from inside wheel | |
# if: matrix.docker-image != 'manylinux2014_i686' | |
# # install dependencies | |
# # uninstall source installation | |
# # move source to make sure it isn't include in checks | |
# run: | | |
# python -m pip install pip-tools | |
# python -m piptools compile -o requirements.txt | |
# mv pyresample unused_src_to_prevent_local_import | |
# python -m pip install -r requirements.txt | |
# python -m pip install --force-reinstall --no-index --no-cache-dir --no-deps --find-links=./dist/ pyresample | |
# python -c "import pyresample; print(pyresample.__file__, pyresample.__version__)" | |
# python -c "import pyresample; assert 'unknown' not in pyresample.__version__, 'incorrect version found'" | |
- name: Upload wheel(s) as build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
upload_test_pypi: | |
needs: [build_sdist, build_wheels] | |
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') | |
steps: | |
- name: Download sdist artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: sdist | |
path: dist | |
- name: Download wheels artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
- name: Publish package to PyPI | |
if: github.event.action != 'published' | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.test_pypi_password }} | |
repository_url: https://test.pypi.org/legacy/ | |
upload_pypi: | |
needs: [build_sdist, build_wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download sdist artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: sdist | |
path: dist | |
- name: Download wheels artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
- name: Publish package to PyPI | |
if: github.event.action == 'published' | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
skip_existing: true |