Skip to content

Commit

Permalink
use pypa/cibuildwheel@v2 to build wheels for mac, windows and linux e…
Browse files Browse the repository at this point in the history
…ach with python 3.9, 3.10 and 3.11
  • Loading branch information
janosh committed Sep 16, 2023
1 parent d85c966 commit 3afb26e
Showing 1 changed file with 49 additions and 7 deletions.
56 changes: 49 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,63 @@ jobs:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml

release:
runs-on: ubuntu-latest
build_source_dist:
needs: tests
runs-on: ubuntu-latest
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
permissions:
# For PyPI trusted publishing
id-token: write
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Build dist
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: "3.10"

- name: Build sdist
run: |
pip install build
python -m build
python -m build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

build_wheels:
name: Build wheels for ${{ matrix.os }}
needs: tests
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["39", "310", "311"]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Build wheels
uses: pypa/cibuildwheel@v2
env:
CIBW_BUILD: cp${{ matrix.python-version }}-*

- name: Save artifact
uses: actions/upload-artifact@v3
with:
path: wheelhouse

release:
needs: [build_wheels, build_source_dist]
runs-on: ubuntu-latest
permissions:
# For pypi trusted publishing
id-token: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down

0 comments on commit 3afb26e

Please sign in to comment.