Skip to content

Build Wheels + PyPI deploy #69

Build Wheels + PyPI deploy

Build Wheels + PyPI deploy #69

Workflow file for this run

name: Build Wheels + PyPI deploy
on:
workflow_dispatch:
inputs:
deploy_to_testpypi:
description: "Whether the build should be deployed to test.pypi.org"
required: true
default: "false"
deploy_to_pypi:
description: "Whether the build should be deployed to pypi.org"
required: true
default: "true"
jobs:
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-24.04
- windows-2022
- macos-13
- macos-14
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Build wheels (arch=${{ matrix.arch }})
uses: pypa/[email protected]
- run: ls -al ./wheelhouse
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
build-sdist:
name: Build source distribution
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: artifact
path: dist/*.tar.gz
test-sdist:
name: Test source distribution on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [build-sdist]
strategy:
matrix:
os:
- ubuntu-24.04
- windows-2022
- macos-14
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.9'
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- name: Install OpenMP
if: runner.os == 'macOS'
run: brew install libomp
- name: Install from SDist
shell: bash
run:
python -m pip install dist/*.tar.gz
- name: Install test requirements
run:
python -m pip install -r requirements-dev.txt
- name: Run test suite
run:
python -m pytest
upload_testpypi:
needs: [build-sdist, test-sdist, build-wheels]
runs-on: ubuntu-24.04
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
if: github.event.inputs.deploy_to_testpypi == 'true'
with:
repository_url: https://test.pypi.org/legacy/
upload_pypi:
needs: [build-sdist, build-wheels, upload_testpypi]
runs-on: ubuntu-24.04
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
if: github.event.inputs.deploy_to_pypi == 'true'