-
Notifications
You must be signed in to change notification settings - Fork 92
96 lines (79 loc) · 2.51 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Build wheels
on:
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # Allow one of the matrix builds to fail without failing others
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install cibuildwheel
run: |
pip install --upgrade pip
pip install cibuildwheel==2.21.3
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels
env:
CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*'
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_SKIP: pp* *-musllinux_* *-manylinux_i686 # skip PyPy, musllinux, 32-bit Linux
run: |
pip install cibuildwheel --upgrade;
python -m cibuildwheel --output-dir dist;
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/*.whl
package_source:
name: Package source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install build
run: python -m pip install build
- name: Run sdist
run: python -m build --sdist
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: ./dist/*.tar.gz
publish_to_pypi:
needs:
- build_wheels
- package_source
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' # Only publish from the master branch
steps:
- name: Download build files
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
# https://github.com/pypa/gh-action-pypi-publish
- name: Publish Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@e53eb8b103ffcb59469888563dc324e3c8ba6f06
with:
skip-existing: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}