[pre-commit.ci] pre-commit autoupdate #817
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 and publish wheels | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build_wheels: | |
name: Wheels on ${{ matrix.os }} with CIBW_ARCHS=${{ matrix.archs }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# Numpy provides wheels for x86_64 and aarch64 only, we do the same | |
include: | |
- os: ubuntu-latest | |
archs: x86_64 aarch64 | |
- os: macos-latest | |
archs: x86_64 | |
- os: macos-latest | |
archs: arm64 | |
- os: windows-latest | |
archs: auto | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
if: ${{ runner.os == 'Linux' }} | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Set up OpenMP | |
# We cannot make OpenMP work for cross-compiled ARM64 macOS wheels, so we do it for x86_64 only | |
if: ${{ runner.os == 'macOS' && matrix.archs == 'x86_64' }} | |
# For OpenMP support we use the LLVM toolchain from Homebrew with libomp. | |
# It looks like LLVM gives faster code than GCC does. | |
run: | | |
brew install llvm libomp | |
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV | |
echo "CONIFEREST_FORCE_OPENMP_ON_MACOS=1" >> $GITHUB_ENV | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS: ${{ matrix.archs }} | |
# We skip MUSL (no numpy binary wheels) and PyPy | |
CIBW_SKIP: "pp* *musl*" | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: wheelhouse/*.whl | |
if-no-files-found: error | |
name: "artifact_${{ matrix.os }}_${{ matrix.archs }}" | |
make_sdist: | |
name: Make SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build SDist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/*.tar.gz | |
if-no-files-found: error | |
name: artifact_sdist | |
publish: | |
needs: [ build_wheels, make_sdist ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: artifact_* | |
merge-multiple: true | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |