Skip to content

Commit

Permalink
Merge pull request #473 from hiddenSymmetries/ml/20250131_fix_wheel_ci
Browse files Browse the repository at this point in the history
Fix wheel workflow
  • Loading branch information
mbkumar authored Feb 2, 2025
2 parents 4f263c8 + 6f17906 commit 56df90e
Showing 1 changed file with 29 additions and 35 deletions.
64 changes: 29 additions & 35 deletions .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,71 @@
name: Wheel Builder

# This file is based on https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml

on: [push, pull_request]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, ubuntu-20.04]
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-14]

steps:
- uses: actions/checkout@v4

- name: Fetch all history for all tags
run: git fetch --prune --unshallow

- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
uses: pypa/cibuildwheel@v2.22.0
# To supply options, put them in 'env'
env:
# Only build for python 3.{9,10,11,12}
CIBW_BUILD : cp39-* cp310-* cp311-* cp312-*
# Supports only x86_64 arch for linux
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_SKIP: cp27-* cp36-* cp37-* cp38-*
CIBW_DEPENDENCY_VERSIONS: latest
# CIBW_BUILD : cp39-* cp310-* cp311-* cp312-*
# # Supports only x86_64 arch for linux
# CIBW_ARCHS_LINUX: x86_64
# CIBW_ARCHS_MACOS: "x86_64 arm64"
# # Skip python 3.8 and PyPy builds since there is are errors when building the
# # wheel in those cases:
CIBW_SKIP: cp38-* pp*
# CIBW_DEPENDENCY_VERSIONS: latest

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Fetch all history for all tags
run: git fetch --prune --unshallow

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.9'

- name: Download all submodules
run: git submodule update --init

- name: Install setuptools_scm
run: python -m pip install setuptools_scm build

- name: Build sdist
run: python -m build -s -o dist .
- uses: actions/upload-artifact@v3
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
environment: pypi
permissions:
id-token: write
# if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down

0 comments on commit 56df90e

Please sign in to comment.