Skip to content

Refine and test use of cibuildwheel #7

Refine and test use of cibuildwheel

Refine and test use of cibuildwheel #7

Workflow file for this run

name: Build/publish Python Package
# Adopted from gh:pybind/scikit_build_example
# Read more on https://cibuildwheel.pypa.io/en/stable
on: [push, pull-request]

Check failure on line 6 in .github/workflows/python_publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/python_publish.yml

Invalid workflow file

You have an error in your yaml syntax on line 6
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published
env:
FORCE_COLOR: 3
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest] # Feltor-8.2 does not build on mac using clang++
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
- name: Build wheels
uses: pypa/cibuildwheel@v3.0.0
env:
CIBW_ENABLE: cpython-prerelease
CIBW_ARCHS_WINDOWS: auto ARM64
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"
- name: Verify clean directory
run: git diff --exit-code
shell: bash
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: wheelhouse/*.whl
upload_all:
name: Upload if release
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment: pypi
permissions:
id-token: write
attestations: write
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
merge-multiple: true
path: dist
- name: Generate artifact attestation for sdist and wheels
uses: actions/attest-build-provenance@v1
with:
subject-path: "dist/*"
- uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true