Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit 20800a2

Browse files
committed
use cibuildwheel
This uses cibuildwheel to build the wheels which will also allow publishing ARM64 wheels.
1 parent aaf0a59 commit 20800a2

3 files changed

Lines changed: 39 additions & 38 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,51 @@
1-
name: publish
2-
on:
1+
name: Build and upload to PyPI
2+
3+
on:
34
push:
4-
tags:
5-
- v1.*
5+
pull_request:
6+
release:
7+
types:
8+
- published
69

710
jobs:
8-
sdist:
9-
runs-on: windows-2019
11+
build_wheels:
12+
name: Build wheels
13+
runs-on: windows-2022
14+
1015
steps:
1116
- uses: actions/checkout@v3
12-
- run: python -m pip install build
13-
- run: python -m build --sdist
17+
18+
- name: Build wheels
19+
uses: pypa/cibuildwheel@v2.12.1
20+
1421
- uses: actions/upload-artifact@v3
1522
with:
16-
name: sdist_${{ github.run_id }}
17-
path: dist/
18-
19-
bdist:
20-
runs-on: windows-2019
21-
strategy:
22-
matrix:
23-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
24-
architecture: ['x86', 'x64']
25-
name: Python ${{ matrix.python-version }} ${{ matrix.architecture }} bdist
23+
path: ./wheelhouse/*.whl
24+
25+
build_sdist:
26+
name: Build source distribution
27+
runs-on: ubuntu-latest
2628
steps:
2729
- uses: actions/checkout@v3
28-
- uses: actions/setup-python@v4
29-
with:
30-
python-version: ${{ matrix.python-version }}
31-
architecture: ${{ matrix.architecture }}
32-
- run: python -m pip install build
33-
- name: Run python -m build --wheel
34-
run: |
35-
Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
36-
Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" -DevCmdArguments '-arch=${{ matrix.architecture }}'
37-
python -m build --wheel
30+
31+
- name: Build sdist
32+
run: pipx run build --sdist
33+
3834
- uses: actions/upload-artifact@v3
3935
with:
40-
name: bdist_${{ matrix.python-version }}_${{ matrix.architecture }}_${{ github.run_id }}
41-
path: dist/
36+
path: dist/*.tar.gz
4237

43-
publish:
44-
needs: [sdist, bdist]
45-
runs-on: ubuntu-20.04
38+
upload_pypi:
39+
needs: [build_wheels, build_sdist]
40+
runs-on: ubuntu-latest
41+
if: github.event_name == 'release' && github.event.action == 'published'
4642
steps:
4743
- uses: actions/download-artifact@v3
4844
with:
49-
path: artifacts
50-
- run: |
51-
mkdir -p dist
52-
mv artifacts/{b,s}dist_*/* dist/
53-
- uses: pypa/gh-action-pypi-publish@release/v1
45+
name: artifact
46+
path: dist
47+
48+
- uses: pypa/gh-action-pypi-publish@v1.5.0
5449
with:
5550
user: __token__
5651
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ lib64/
2424
parts/
2525
sdist/
2626
var/
27+
wheelhouse/
2728
wheels/
2829
pip-wheel-metadata/
2930
share/python-wheels/

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
[build-system]
22
requires = ["setuptools", "wheel", "scikit-build", "cmake", "ninja"]
33
build-backend = "setuptools.build_meta"
4+
5+
[tool.cibuildwheel]
6+
skip = "pp*"
7+
archs = "all"
8+
build-verbosity = 1

0 commit comments

Comments
 (0)