Skip to content

Build Wheels, Test and Release #24

Build Wheels, Test and Release

Build Wheels, Test and Release #24

Workflow file for this run

name: Build Wheels, Test and Release
on:
release:
types: [created]
jobs:
build_linux_wheels:
name: Build ${{ matrix.cibw_python }}-${{ matrix.cibw_libc }}_${{ matrix.cibw_arch }} wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
cibw_python: ["cp39", "cp310", "cp311", "cp312", "pp39"]
# SciPy and NumPy don't support musllinux
cibw_libc: ["manylinux"]
cibw_arch: ["x86_64", "aarch64"]
exclude:
# Numpy only supports pypy39 x86_64 on Linux
- cibw_python: "pp39"
cibw_arch: "aarch64"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Build the wheel
run: |
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_python }}-${{ matrix.cibw_libc }}_${{ matrix.cibw_arch }}
- uses: actions/upload-artifact@v4
name: Upload wheels as artifacts
if: ${{ github.event_name != 'pull_request' }}
with:
name: wheels-${{ matrix.cibw_python }}-${{ matrix.cibw_libc }}_${{ matrix.cibw_arch }}
path: ./dist/*.whl
build_macos_wheels:
name: Build ${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }} wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-12]
cibw_python: ["cp39", "cp310", "cp311", "cp312", "pp39"]
cibw_arch: ["x86_64"]
exclude:
# cibuildwheel only supports pypy39 x86_64 on MacOS
- cibw_python: "pp39"
cibw_arch: "arm64"
- cibw_python: "pp39"
cibw_arch: "universal2"
env:
MACOSX_DEPLOYMENT_TARGET: "12.0"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install FFTW3 libraries
run: |
brew install fftw
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Build wheels for CPython (MacOS)
run: |
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }}
- uses: actions/upload-artifact@v4
name: Upload wheels as artifacts
if: ${{ github.event_name != 'pull_request' }}
with:
name: wheels-${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }}
path: ./dist/*.whl
deploy:
name: Release
needs: [build_macos_wheels, build_linux_wheels]
# needs: [build_linux_wheels]
# if: github.repository_owner == 'pyFFTW' && startsWith(github.ref, 'refs/tags/v') && always()
if: github.repository_owner == 'mlgig' && always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
- name: Install Twine and Build
run: |
python -m pip install --upgrade pip
pip install twine build
- uses: actions/download-artifact@v4
id: download
with:
path: ./dist
merge-multiple: true
- name: Publish the source distribution on PyPI
run: |
# MRSEQL_VERSION=$(git describe --tags)
pip install cython
python setup.py sdist
ls -la ${{ github.workspace }}/dist
# We prefer to release wheels before source because otherwise there is a
# small window during which users who pip install pyfftw will require compilation.
twine upload ${{ github.workspace }}/dist/*.whl
# twine upload --repository testpypi ${{ github.workspace }}/dist/*.whl
# twine upload ${{ github.workspace }}/dist/*.tar.gz
# twine upload --repository testpypi ${{ github.workspace }}/dist/*.tar.gz
env:
# TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: Github release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}