Merge pull request #254 from johnnynunez/patch-3 #247
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: Wheels | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build_sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- run: pipx run build --sdist | |
- run: pipx run twine check dist/* || exit 1 # Ensure failure on twine check errors | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-sdist | |
path: dist/*.tar.gz | |
build_wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-14, macos-13, windows-latest] # Use specific versions for clarity | |
arch: [x86_64, arm64] | |
pybuilds: [cp38, cp39, cp310, cp311, cp312] # Define pybuilds at the top level | |
exclude: | |
- os: ubuntu-24.04-arm # No need to specify arch, it's already implicit | |
arch: x86_64 # Exclude x86_64 on ARM | |
- os: macos-14 # Exclude macOS 14 (Sonoma) | |
arch: x86_64 # Exclude x86_64 explicitly | |
- os: macos-14 # Exclude cp38 | |
pybuilds: cp38 | |
- os: macos-13 # Exclude macOS 13 (Ventura) - arm64 | |
arch: arm64 # Exclude arm64 on macOS 13 | |
- os: macos-13 | |
pybuilds: cp38 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- run: pip install cibuildwheel==2.23.0 | |
- run: python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_BUILD: "${{ matrix.pybuilds }}-*" # Use matrix.pybuilds and matrix.arch | |
CIBW_ARCHS_MACOS: ${{ matrix.arch }} | |
CIBW_SKIP: "cp*-manylinux_i686 cp*-musllinux* cp*-win32" | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true # Important: Continue if upload fails | |
with: | |
# Include pybuilds in the artifact name | |
name: wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.pybuilds }} | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error # Fail if no wheels are found | |
compression-level: 6 | |
overwrite: false | |
include-hidden-files: false | |
release_artifacts: | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: ./artifacts | |
merge-multiple: true | |
- run: ls -R ./artifacts | |
- uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
artifacts: "./artifacts/**/*" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: pypa/[email protected] | |
with: | |
packages-dir: ./artifacts |