| 1 |
name: Build wheels |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [ main ] |
| 6 |
tags: |
| 7 |
- v* |
| 8 |
|
| 9 |
pull_request: |
| 10 |
branches: [ main ] |
| 11 |
|
| 12 |
paths: |
| 13 |
- '**.c' |
| 14 |
- setup.py |
| 15 |
- setup.cfg |
| 16 |
- pyproject.toml |
| 17 |
- .github/workflows/wheels.yml |
| 18 |
|
| 19 |
jobs: |
| 20 |
build_wheels: |
| 21 |
name: Build wheels on ${{ matrix.archs }} for ${{ matrix.os }} |
| 22 |
runs-on: ${{ matrix.os }} |
| 23 |
strategy: |
| 24 |
matrix: |
| 25 |
os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-24.04-arm] |
| 26 |
|
| 27 |
steps: |
| 28 |
- uses: actions/checkout@v4 |
| 29 |
|
| 30 |
- name: Set up QEMU |
| 31 |
if: ${{ matrix.archs == 'aarch64' }} |
| 32 |
uses: docker/setup-qemu-action@v3 |
| 33 |
|
| 34 |
- uses: actions/setup-python@v5 |
| 35 |
name: Install Python |
| 36 |
with: |
| 37 |
python-version: '3.8' |
| 38 |
|
| 39 |
- name: Build wheels |
| 40 |
uses: joerick/[email protected] |
| 41 |
env: |
| 42 |
CIBW_SKIP: pp* |
| 43 |
CIBW_ARCHS_MACOS: auto universal2 |
| 44 |
|
| 45 |
- uses: actions/upload-artifact@v4 |
| 46 |
with: |
| 47 |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 48 |
path: ./wheelhouse/*.whl |
| 49 |
|
| 50 |
build_sdist: |
| 51 |
name: Build source distribution |
| 52 |
runs-on: ubuntu-latest |
| 53 |
steps: |
| 54 |
- uses: actions/checkout@v4 |
| 55 |
|
| 56 |
- uses: actions/setup-python@v5 |
| 57 |
name: Install Python |
| 58 |
with: |
| 59 |
python-version: '3.8' |
| 60 |
|
| 61 |
- name: Check manifest |
| 62 |
run: pipx run check-manifest |
| 63 |
|
| 64 |
- name: Build sdist |
| 65 |
run: python setup.py sdist |
| 66 |
|
| 67 |
- uses: actions/upload-artifact@v4 |
| 68 |
with: |
| 69 |
name: cibw-sdist |
| 70 |
path: dist/*.tar.gz |
| 71 |
|
| 72 |
upload_pypi: |
| 73 |
needs: [build_wheels, build_sdist] |
| 74 |
runs-on: ubuntu-latest |
| 75 |
|
| 76 |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') |
| 77 |
environment: |
| 78 |
name: pypi |
| 79 |
url: https://pypi.org/p/pyinstrument |
| 80 |
permissions: |
| 81 |
id-token: write |
| 82 |
attestations: write |
| 83 |
|
| 84 |
steps: |
| 85 |
- uses: actions/download-artifact@v4 |
| 86 |
with: |
| 87 |
|
| 88 |
pattern: cibw-* |
| 89 |
path: dist |
| 90 |
merge-multiple: true |
| 91 |
|
| 92 |
- uses: pypa/gh-action-pypi-publish@release/v1 |