Skip to content

Support for cibuildwheel #8

Support for cibuildwheel

Support for cibuildwheel #8

Workflow file for this run

name: Build
on:
pull_request:
push:
branches:
- master
workflow_dispatch:
inputs:
version:
description: 'The version of COFFE to release'
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
- name: Setup all external dependencies
if: runner.os == 'macOS'
run: |
brew install fftw gsl cuba automake jq
if [ "$(uname -m)" = 'arm64' ]
then
echo "BREW_PREFIX=/opt/homebrew/Cellar/" >> "$GITHUB_ENV"
else
echo "BREW_PREFIX=/usr/local/Cellar/" >> "$GITHUB_ENV"
fi
echo "GSL_VERSION=$(brew info --json gsl | jq -r '.[0].installed[0].version')" >> "$GITHUB_ENV"
echo "FFTW_VERSION=$(brew info --json fftw | jq -r '.[0].installed[0].version')" >> "$GITHUB_ENV"
echo "CUBA_VERSION=$(brew info --json cuba | jq -r '.[0].installed[0].version')" >> "$GITHUB_ENV"
# Used to host cibuildwheel
- uses: actions/setup-python@v3
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.5
# if we're not doing a release version (manual!), only build one python version
- name: Setup versions
if: ${{ ! (github.event_name == 'workflow_dispatch' && github.event.inputs.version) }}
run: |
echo "CIBW_BUILD=cp311-*" >> "$GITHUB_ENV"
# pretend version so setuptools doesn't fail
echo "SETUPTOOLS_SCM_PRETEND_VERSION=0.1.0" >> "$GITHUB_ENV"
- name: SCM
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version
run: echo "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.input.version }}" >> "$GITHUB_ENV"
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
# to supply options, put them in 'env', like:
env:
# we skip tests in CI to save time
CIBW_TEST_COMMAND: 'true'
CIBW_ENVIRONMENT_PASS_LINUX: 'SETUPTOOLS_SCM_PRETEND_VERSION'
CIBW_BEFORE_ALL_MACOS: >
bash scripts/install_other.sh class
CIBW_ENVIRONMENT_MACOS: >
CFLAGS="-I${BREW_PREFIX}/gsl/${GSL_VERSION}/include -I${BREW_PREFIX}/fftw/${FFTW_VERSION}/include -I${BREW_PREFIX}/cuba/${CUBA_VERSION}/include -I/opt/class_public/include ${CFLAGS}"
LDFLAGS="-L${BREW_PREFIX}/gsl/${GSL_VERSION}/lib -L${BREW_PREFIX}/fftw/${FFTW_VERSION}/lib -L${BREW_PREFIX}/cuba/${CUBA_VERSION}/lib -L/opt/class_public/lib ${LDFLAGS}"
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl