Build wheels #9
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 wheels | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
release: | |
types: [published] | |
permissions: # Ensure the workflow has permission to push changes | |
contents: write # Allow write access for pushing to the repository | |
jobs: | |
build_wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest] | |
python-version: ["3.9"] | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Clean up previous builds (if any) | |
run: | | |
rm -rf build dist *.egg-info class-sz/python/classy_sz.*so class-sz/python/classy_sz.*egg-info | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.14.1 | |
# Build wheels for Linux (with custom build options) | |
- name: Build wheels for Linux | |
if: matrix.os == 'ubuntu-latest' | |
env: | |
CIBW_BEFORE_BUILD: "yum install -y gsl-devel fftw-devel" | |
CIBW_ARCHS: aarch64 | |
CIBW_BUILD: cp39-manylinux_aarch64 | |
run: python -m cibuildwheel --output-dir wheelhouse | |
- name: Install dependencies on macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install gsl fftw | |
chmod +x select_makefile.sh | |
./select_makefile.sh | |
make clean | |
working-directory: class-sz | |
# Build wheels for macOS (with Apple Silicon support) | |
- name: Build wheels for macOS | |
if: matrix.os == 'macos-latest' | |
env: | |
CIBW_ARCHS: "arm64" | |
run: python -m cibuildwheel --output-dir wheelhouse | |
# Build wheels for Windows (default) | |
- name: Build wheels for Windows | |
if: matrix.os == 'windows-latest' | |
run: python -m cibuildwheel --output-dir wheelhouse | |
- name: Build source distribution (sdist) | |
run: python setup.py sdist bdist_wheel | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.os }}-${{ matrix.python-version }} | |
path: wheelhouse/*.whl |