Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 52 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ jobs:
pip install pytest
pytest

build-for-publish:
build-wheels-for-publish:
name: Build distribution 📦
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags')"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-latest-arm, windows-latest, macos-latest]
needs: test
steps:
- uses: actions/checkout@v4
Expand All @@ -68,24 +71,55 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade build
python -m pip install cibuildwheel==2.16.2

- name: Build a source tarball and wheel
run: python -m build .
- name: Build wheels
env:
CIBW_SKIP: "pp* *-musllinux_*"
run: python -m cibuildwheel --output-dir wheelhouse

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
# NOTE: for now upload sdist only to prevent errors like unsupported platform tag 'linux_x86_64'.
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build-sdist-for-publish:
name: Build source distribution 📦
if: "startsWith(github.ref, 'refs/tags')"
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Install build tool
run: python -m pip install sdist
- name: Build source distribution
run: python setup.py sdist
- name: Upload sdist artifact
uses: actions/upload-artifact@v4
with:
name: sdist-artifact
path: dist/*.tar.gz

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build-for-publish
- build-wheels-for-publish
- build-sdist-for-publish
runs-on: ubuntu-latest
environment:
name: pypi
Expand All @@ -96,12 +130,20 @@ jobs:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
# unpacks all CIBW artifacts into dist/
path: dist
pattern: cibw-wheels-*
merge-multiple: true
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: sdist-artifact
path: dist
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
password: ${{ secrets.PYPI_TOKEN }}

# NOTE: for testing purposes only
# publish-to-testpypi:
Expand Down