Skip to content

Commit 99399aa

Browse files
committed
Refactor GitHub Actions workflow for building wheels and source distributions. Updated OS matrix and improved architecture handling. Replaced Python setup steps with direct usage of cibuildwheel and pipx for building. Enhanced artifact management during publish step.
1 parent b215458 commit 99399aa

1 file changed

Lines changed: 28 additions & 21 deletions

File tree

.github/workflows/publish.yml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,41 @@ on:
1414
jobs:
1515
build_wheels:
1616
name: Build wheels on ${{ matrix.os }}
17-
runs-on: ${{ matrix.os }}
17+
runs-on: ${{ matrix.runs-on }}
1818
strategy:
1919
matrix:
20-
os: [ubuntu-latest, windows-latest, macOS-latest, macos-13, ubuntu-24.04-arm, ]
20+
os: [ linux-intel, linux-arm, windows, macOS-intel, macOS-arm ]
21+
include:
22+
- archs: auto
23+
platform: auto
24+
- os: linux-intel
25+
runs-on: ubuntu-latest
26+
- os: linux-arm
27+
runs-on: ubuntu-24.04-arm
28+
- os: windows
29+
runs-on: windows-latest
30+
- os: macos-intel
31+
# macos-13 was the last x86_64 runner
32+
runs-on: macos-13
33+
- os: macos-arm
34+
# macos-14+ (including latest) are ARM64 runners
35+
runs-on: macos-latest
36+
archs: auto,universal2
2137

2238
steps:
2339
- uses: actions/checkout@v4
2440
with:
2541
ref: ${{ github.event.inputs.branch }}
2642

27-
- name: Set up Python 3.12
28-
uses: actions/setup-python@v5
29-
with:
30-
python-version: "3.12"
31-
32-
- name: Install cibuildwheel
33-
run: python -m pip install cibuildwheel==2.23.2
34-
3543
- name: Build wheels
36-
run: python -m cibuildwheel --output-dir wheelhouse
44+
uses: pypa/cibuildwheel@v2.23.2
45+
env:
46+
CIBW_PLATFORM: ${{ matrix.platform }}
47+
CIBW_ARCHS: ${{ matrix.archs }}
3748

3849
- uses: actions/upload-artifact@v4
3950
with:
51+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
4052
path: ./wheelhouse/*.whl
4153

4254
build_sdist:
@@ -47,19 +59,12 @@ jobs:
4759
with:
4860
ref: ${{ github.event.inputs.branch }}
4961

50-
- name: Set up Python 3.12
51-
uses: actions/setup-python@v5
52-
with:
53-
python-version: "3.12"
54-
55-
- name: Install build
56-
run: python -m pip install build
57-
5862
- name: Build sdist
59-
run: python -m build --sdist
63+
run: pipx run build --sdist
6064

6165
- uses: actions/upload-artifact@v4
6266
with:
67+
name: cibw-sdist
6368
path: dist/*.tar.gz
6469

6570
publish:
@@ -68,8 +73,10 @@ jobs:
6873
steps:
6974
- uses: actions/download-artifact@v4
7075
with:
71-
name: artifact
76+
# unpacks all CIBW artifacts into dist/
77+
pattern: cibw-*
7278
path: dist
79+
merge-multiple: true
7380
- name: Publish package to TestPyPI
7481
uses: pypa/gh-action-pypi-publish@release/v1
7582
with:

0 commit comments

Comments
 (0)