Skip to content

Build and publish wheels #6

Build and publish wheels

Build and publish wheels #6

name: Build and publish 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:
# bump_version:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the code
# uses: actions/checkout@v4
# with:
# persist-credentials: true
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3.x"
# - name: Install bump2version
# run: python -m pip install bump2version
# - name: Bump version (patch)
# run: |
# bump2version patch --current-version $(grep -Eo 'version="[^"]*' setup.py | cut -d'"' -f2) setup.py
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Commit and push version bump
# run: |
# git config --global user.name "GitHub Actions"
# git config --global user.email "[email protected]"
# git commit -am "Bump version"
# git push
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_wheels:

Check failure on line 47 in .github/workflows/python-publish.yml

View workflow run for this annotation

GitHub Actions / Build and publish wheels

Invalid workflow file

The workflow is not valid. .github/workflows/python-publish.yml (Line: 47, Col: 3): The workflow must contain at least one job with no dependencies.
runs-on: ${{ matrix.os }}
needs: bump_version
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
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: Make clean (for class-sz)
run: |
chmod +x select_makefile.sh
./select_makefile.sh
make clean
working-directory: class-sz
- 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
# Build wheels for macOS (with Apple Silicon support)
- name: Build wheels for macOS
if: matrix.os == 'macos-latest'
env:
CIBW_ARCHS: "x86_64 arm64"
CIBW_BUILD: cp39-macosx_11_0_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
# publish_wheels:
# runs-on: ubuntu-latest
# needs: build_wheels
# if: github.event_name == 'release' && github.event.action == 'published'
# steps:
# - name: Checkout the code
# uses: actions/checkout@v4
# - name: Download built wheels
# uses: actions/download-artifact@v4
# with:
# name: wheels-*
# - name: Install dependencies for uploading
# run: python -m pip install -U pip twine
# - name: Upload wheels to PyPI
# env:
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# run: twine upload wheelhouse/* dist/*