build-dist #10
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: build-dist | |
on: | |
workflow_dispatch: | |
inputs: | |
cibw_skip: | |
required: false | |
type: string | |
description: "wheels to skip building" | |
workflow_call: | |
inputs: | |
cibw_skip: | |
required: false | |
type: string | |
description: "wheels to skip building" | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
env: | |
CIBW_SKIP: pp* *i686 ${{ github.event.inputs.cibw_skip }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: wheelhouse/*.whl | |
build_wheels_macos: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest] | |
cibw_python: ["cp39-*", "cp310-*", "cp311-*"] | |
cibw_arch: ["x86_64", "arm64"] | |
env: | |
CIBW_BUILD: ${{ matrix.cibw_python }} | |
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup openmp for macOS | |
run: | | |
# Make sure to use a libomp version binary compatible with the oldest | |
# supported version of the macos SDK as libomp will be vendored into | |
# the smol wheels for macos. The list of binaries are in | |
# https://packages.macports.org/libomp/. Currently, the oldest | |
# supported macos version is: High Sierra / 10.13. When upgrading | |
# this, be sure to update the MACOSX_DEPLOYMENT_TARGET environment | |
# variable accordingly. Note that Darwin_17 == High Sierra / 10.13. | |
if [[ "$CIBW_ARCHS_MACOS" == arm64 ]]; then | |
# arm64 builds must cross compile because the CI instance is x86 | |
# This turns off the computation of the test program in | |
# tools/build_helpers.py | |
echo "PYTHON_CROSSENV=1" >> "$GITHUB_ENV" | |
# SciPy requires 12.0 on arm to prevent kernel panics | |
# https://github.com/scipy/scipy/issues/14688 | |
# so being conservative, we just do the same here | |
echo "MACOSX_DEPLOYMENT_TARGET=12.0" >> "$GITHUB_ENV" | |
OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-arm64/llvm-openmp-11.1.0-hf3c4609_1.tar.bz2" | |
else | |
echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> "$GITHUB_ENV" | |
OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-64/llvm-openmp-11.1.0-hda6cdc1_1.tar.bz2" | |
fi | |
# use conda to install llvm-openmp | |
# Note that we do NOT activate the conda environment, we just add the | |
# library install path to CFLAGS/CXXFLAGS/LDFLAGS below. | |
sudo conda create -n build $OPENMP_URL | |
PREFIX="/usr/local/miniconda/envs/build" | |
echo "CC=/usr/bin/clang" >> "$GITHUB_ENV" | |
echo "CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp"" >> "$GITHUB_ENV" | |
echo "CFLAGS="$CFLAGS -Wno-implicit-function-declaration -I$PREFIX/include"" >> "$GITHUB_ENV" | |
echo "LDFLAGS="$LDFLAGS -Wl,-S -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp"" >> "$GITHUB_ENV" | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: wheelhouse/*.whl | |
build_sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Optional, use if you use setuptools_scm | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/*.tar.gz |