-
Notifications
You must be signed in to change notification settings - Fork 13
108 lines (91 loc) · 2.89 KB
/
wheels.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
97
98
99
100
101
102
103
104
105
106
107
108
name: Build wheels and upload to PyPI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published
jobs:
setup_build_targets:
name: Setup build targets
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v3
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.21.3
- name: Generate strategy matrix
id: set-matrix
run: python3 ci/cibuildwheel_matrix.py
build_wheels:
name: Build wheels for ${{ matrix.target.version }} on ${{ matrix.target.os }}
needs: setup_build_targets
runs-on: ${{ matrix.target.os }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup_build_targets.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BEFORE_ALL_LINUX: bash ci/cibw_before_all_linux.sh
CIBW_BEFORE_ALL_WINDOWS: bash ci/cibw_before_all_windows.sh
CIBW_BEFORE_ALL_MACOS: bash ci/cibw_before_all_macos_${{ runner.os == macos-14 && 'arm64' || 'x86_64' }}.sh
CIBW_BUILD: ${{ matrix.target.build }}
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Build sdist
run: pipx run build --sdist
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/piqp
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
# repository-url: https://test.pypi.org/legacy/