Issue 952 #98
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: Release | |
on: [push, pull_request] | |
jobs: | |
build_sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build distribution | |
run: | | |
export RELEASE_VERSION=${{ github.ref_name }} | |
pip install numpy cython | |
pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-artifacts | |
path: dist/*.tar.gz | |
# adapted from | |
# https://github.com/biopython/biopython/blob/master/.github/workflows/ci.yml | |
build_wheels: | |
name: Build wheels (py ${{ matrix.pyver }}) ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
pyver: ["37", "38", "39", "310", "311", "312"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Install Python packaging tools | |
run: | | |
export RELEASE_VERSION=${{ github.ref_name }} | |
pip install numpy cython | |
python -m pip install --upgrade pip setuptools wheel | |
# https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml | |
- name: Build wheels (py ${{ matrix.pyver }}) Linux | |
if: matrix.os == 'ubuntu-latest' | |
env: | |
CIBW_ARCHS_LINUX: "x86_64 aarch64" | |
CIBW_SKIP: "*-musllinux*" | |
CIBW_BUILD: "cp${{ matrix.pyver }}-*" | |
uses: pypa/[email protected] | |
- name: Build wheels (py ${{ matrix.pyver }}) MacOS | |
if: matrix.os == 'macos-latest' | |
env: | |
CIBW_ARCHS_MACOS: "x86_64 arm64 universal2" | |
CIBW_BUILD: "cp${{ matrix.pyver }}-*" | |
uses: pypa/[email protected] | |
- name: Build wheels (py ${{ matrix.pyver }}) Windows | |
if: matrix.os == 'windows-latest' | |
env: | |
CIBW_ARCHS_WINDOWS: "amd64 win32 arm64" | |
CIBW_BUILD: "cp${{ matrix.pyver }}-*" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-artifacts | |
path: ./wheelhouse/*.whl | |
release: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
# this is not ideal as it doesn't limit to what type of tag | |
# but it at least seems to work | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Stage artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist-artifacts | |
path: dist/ | |
- name: Check artifacts | |
run: ls -lrt dist/ | |
- name: Publish a Python distribution to PyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |