feat: use scikit-build-core (#13) #39
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: Build | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build_wheels: | |
name: Wheels (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ macos-13, macos-14, windows-2022 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: "cp312-*" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
build_linux_wheels: | |
runs-on: ubuntu-latest | |
name: Linux (${{ matrix.arch }}, ${{ matrix.tag }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [ x86_64, i686, aarch64, ppc64le ] | |
tag: [ manylinux, musllinux ] | |
# TODO(charlie): Fails to compile, root cause is unexplored. | |
exclude: | |
- arch: aarch64 | |
tag: musllinux | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
if: ${{ matrix.arch }} != 'x86_64' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS_LINUX: ${{ matrix.arch }} | |
CIBW_BUILD: "cp312-${{ matrix.tag }}_*" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-linux-${{ matrix.arch }}-${{ matrix.tag }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
# Verify that the x86_64 wheels work on macOS 11. | |
test_macos_11: | |
name: Test macOS 11 | |
runs-on: macos-11 | |
needs: build_wheels | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: cibw-wheels-macos-13-0 | |
path: wheelhouse | |
- name: Install wheel | |
run: pip install wheelhouse/*.whl | |
- name: Test wheel | |
run: python -m whisper_cpp -h | |
upload_pypi: | |
needs: [ build_wheels, build_linux_wheels, build_sdist ] | |
runs-on: ubuntu-latest | |
environment: pypi | |
permissions: | |
id-token: write | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
# unpacks all CIBW artifacts into dist/ | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |