Use scikit-build-core and cibuildwheel to build the package #83
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: Wheels | |
on: | |
pull_request: | |
branches: | |
- master | |
paths: | |
- ".github/workflows/wheels.yml" | |
release: | |
types: [published] | |
concurrency: | |
group: wheels-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
build-wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- windows-2022 | |
- ubuntu-22.04 | |
- macos-14 | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: cppbinder-wheels-${{ matrix.os }} | |
path: ./wheelhouse/*.whl | |
- name: Upload wheels to release | |
if: github.event_name == 'release' | |
shell: bash | |
run: | | |
gh release upload ${{ github.ref_name }} ./wheelhouse/*.whl --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-sdist: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build source distribution | |
run: | | |
rm build.py # to avoid conflict with the build package | |
python -m build --sdist --outdir dist | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: cppbinder-sdist | |
path: ./dist/*.tar.gz | |
- name: Upload wheels to release | |
if: github.event_name == 'release' | |
run: | | |
gh release upload ${{ github.ref_name }} ./dist/*.tar.gz --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish: | |
needs: [build-wheels, build-sdist] | |
if: github.event_name == 'release' | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download wheels | |
run: | | |
gh release download ${{ github.ref_name }} --pattern *.whl --pattern *.tar.gz --dir dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish package to PyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages-dir: dist |