Merge pull request #187 from pytroll/dependabot/github_actions/pypa/g… #282
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: Build Package | |
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@v4 | |
with: | |
name: sdist | |
path: dist/*.tar.gz | |
build_wheels: | |
name: "Build wheels on ${{ matrix.os }} ${{ matrix.cibw_archs }}" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-2019 | |
cibw_archs: "AMD64 ARM64" | |
artifact_name: "win" | |
- os: macos-12 | |
cibw_archs: "x86_64 arm64" | |
artifact_name: "mac" | |
- os: "ubuntu-20.04" | |
cibw_archs: "aarch64" | |
artifact_name: "ubuntu-aarch" | |
- os: "ubuntu-20.04" | |
cibw_archs: "x86_64" | |
artifact_name: "ubuntu-x86_64" | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
git fetch --prune --unshallow | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_SKIP: "cp36-* cp37-* cp38-* pp* *-manylinux_i686 *-musllinux_i686 *-musllinux_aarch64 *-win32" | |
CIBW_ARCHS: "${{ matrix.cibw_archs }}" | |
CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.artifact_name }} | |
path: ./wheelhouse/*.whl | |
upload_to_pypi: | |
needs: [build_sdist, build_wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download sdist artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: sdist | |
path: dist | |
- name: Download wheels artifact - win | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheels-win | |
path: dist | |
- name: Download wheels artifact - mac | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheels-mac | |
path: dist | |
- name: Download wheels artifact - ubuntu aarch | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheels-ubuntu-aarch | |
path: dist | |
- name: Download wheels artifact - ubuntu x86_64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheels-ubuntu-x86_64 | |
path: dist | |
- name: Publish package to Test PyPI | |
if: github.event.action != 'published' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.test_pypi_password }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish package to PyPI | |
if: github.event.action == 'published' | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |