Build binary wheels and sdist #54
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 binary wheels and sdist | |
on: | |
push: | |
tags: | |
- v* | |
schedule: | |
- cron: "12 02 * * SUN" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build_wheels: | |
name: ${{ matrix.arch }} wheels on ${{ matrix.os }} | |
if: github.repository_owner == 'contourpy' | |
runs-on: ${{ matrix.os }} | |
env: | |
CIBW_PRERELEASE_PYTHONS: True | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
arch: aarch64 | |
- os: ubuntu-latest | |
arch: ppc64le | |
- os: ubuntu-latest | |
arch: s390x | |
- os: ubuntu-latest | |
arch: x86_64 | |
- os: macOS-14 | |
arch: arm64 | |
- os: macOS-13 | |
arch: x86_64 | |
- os: windows-latest | |
arch: AMD64 | |
- os: windows-latest | |
arch: x86 | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Setup MSVC (32-bit) | |
if: ${{ matrix.arch == 'x86' }} | |
uses: bus1/cabuild/action/msdevshell@v1 | |
with: | |
architecture: 'x86' | |
- name: Fix PATH on win32 | |
# Avoid this in GHA: "ERROR: Found GNU link.exe instead of MSVC link.exe" | |
if: ${{ matrix.arch == 'x86' }} | |
run: | | |
rm /c/Program\ Files/Git/usr/bin/link.EXE | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS: ${{ matrix.arch }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels_${{ matrix.os }}_${{ matrix.arch }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build sdist | |
if: github.repository_owner == 'contourpy' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install build | |
- name: Build sdist | |
run: | | |
python -m build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: contourpy-sdist | |
path: dist/*.tar.gz | |
merge_wheels: | |
name: Merge wheel build artifacts | |
runs-on: ubuntu-latest | |
needs: build_wheels | |
steps: | |
- name: Merge artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: contourpy-wheels | |
pattern: wheels* | |
delete-merged: true | |
upload_nightlies: | |
name: Upload nightly wheels | |
if: github.repository_owner == 'contourpy' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: merge_wheels | |
steps: | |
- name: Download merged wheel artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: contourpy-wheels | |
path: dist | |
- name: List wheels | |
run: ls -l dist | |
- name: Upload wheels to scientific python | |
uses: scientific-python/upload-nightly-action@b67d7fcc0396e1128a474d1ab2b48aa94680f9fc # 0.5.0 | |
with: | |
artifacts_path: dist | |
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} |