-
Notifications
You must be signed in to change notification settings - Fork 33
189 lines (174 loc) · 6.11 KB
/
build_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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Build wheels
run-name: Build wheels - ${{ github.sha }}
on:
push:
branches:
- 'master'
- 'release/**'
jobs:
build_windows_wheels:
strategy:
matrix:
py: [cp38, cp39, cp310, cp311, cp312]
arch:
- [AMD64, win_amd64, x64, x64, 64bit]
- [x86, win32, x86, Win32, 32bit]
name: ${{ matrix.py }}-${{ matrix.arch[1] }}
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compile pthread-win32
run: |
Import-Module 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll'
Enter-VsDevShell -VsInstallPath 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise' -DevCmdArguments '-arch=x64' -StartInPath 'C:\'
git clone https://github.com/GerHobbelt/pthread-win32.git
cd C:\pthread-win32\windows\VS2022
msbuild .\pthread.2022.sln -t:pthread_static_lib -p:Configuration=Release,Platform=${{ matrix.arch[3] }}
cd C:\
mkdir C:\pthread-win32_static_lib
mkdir C:\pthread-win32_static_lib\include
mkdir C:\pthread-win32_static_lib\lib
cp C:\pthread-win32\windows\VS2022\bin\Release-Unicode-${{ matrix.arch[4] }}-${{ matrix.arch[2] }}\pthread_static_lib.lib C:\pthread-win32_static_lib\lib\pthread.lib
cp C:\pthread-win32\_ptw32.h C:\pthread-win32_static_lib\include
cp C:\pthread-win32\pthread.h C:\pthread-win32_static_lib\include
cp C:\pthread-win32\sched.h C:\pthread-win32_static_lib\include
cp C:\pthread-win32\semaphore.h C:\pthread-win32_static_lib\include
- name: Build wheel ${{ matrix.py }}-${{ matrix.arch[1] }}
uses: pypa/[email protected]
env:
PTHREAD_WIN_INCLUDE: C:\pthread-win32_static_lib\include
PTHREAD_WIN_LIB: C:\pthread-win32_static_lib\lib
CIBW_PLATFORM: windows
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.arch[1] }}
CIBW_ARCHS_WINDOWS: ${{ matrix.arch[0] }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels_${{ matrix.py }}_${{ matrix.arch[1] }}
path: ./wheelhouse/*.whl
if-no-files-found: error
build_macos_wheels:
strategy:
matrix:
config:
[
{
py: cp38,
arch: [x86_64, macosx_x86_64, 12.0, macos-12]
},
{
py: cp39,
arch: [x86_64, macosx_x86_64, 12.0, macos-12]
},
{
py: cp310,
arch: [x86_64, macosx_x86_64, 12.0, macos-12]
},
{
py: cp311,
arch: [x86_64, macosx_x86_64, 12.0, macos-12]
},
{
py: cp312,
arch: [x86_64, macosx_x86_64, 12.0, macos-12]
},
{
py: cp38,
arch: [arm64, macosx_arm64, 12.0, macos-14]
},
{
py: cp39,
arch: [arm64, macosx_arm64, 12.0, macos-14]
},
{
py: cp310,
arch: [arm64, macosx_arm64, 12.0, macos-14]
},
{
py: cp311,
arch: [arm64, macosx_arm64, 12.0, macos-14]
},
{
py: cp312,
arch: [arm64, macosx_arm64, 12.0, macos-14]
}
]
name: ${{ matrix.config.py }}-${{ matrix.config.arch[1] }}
runs-on: ${{ matrix.config.arch[3] }}
if:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pipx # NOTE: required only for arm64
if: startsWith(matrix.config.arch[0], 'arm64')
run: |
brew install pipx
- name: Build wheel ${{ matrix.config.py }}-${{ matrix.config.arch[1] }}
uses: pypa/[email protected]
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.arch[2] }}
CIBW_PLATFORM: macos
CIBW_BUILD: ${{ matrix.config.py }}-${{ matrix.config.arch[1] }}
CIBW_ARCHS_MACOS: ${{ matrix.config.arch[0] }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels_${{ matrix.config.py }}_${{ matrix.config.arch[1] }}
path: ./wheelhouse/*.whl
if-no-files-found: error
build_linux_wheels:
strategy:
matrix:
py: [cp38, cp39, cp310, cp311, cp312]
arch:
- [x86_64, manylinux_x86_64, amd64]
- [aarch64, manylinux_aarch64, arm64]
name: ${{ matrix.py }}-${{ matrix.arch[1] }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/[email protected]
with:
platforms: ${{ matrix.arch[2] }}
- name: Build wheel ${{ matrix.py }}-${{ matrix.arch[1] }}
uses: pypa/[email protected]
env:
CIBW_PLATFORM: linux
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.arch[1] }}
CIBW_ARCHS_LINUX: ${{ matrix.arch[0] }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels_${{ matrix.py }}_${{ matrix.arch[1] }}
path: ./wheelhouse/*.whl
if-no-files-found: error
build_source_distribution:
name: sdist
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build source distribution
run: |
pip install -U pip
pip install -U build
python -m build --sdist
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/*.tar.gz
if-no-files-found: error
run_id:
name: Create/Update WHEELS_ARTIFACTS_RUN_ID secret
runs-on: ubuntu-latest
needs: [build_windows_wheels, build_macos_wheels, build_linux_wheels, build_source_distribution]
steps:
- uses: actions/checkout@v4
- run: |
gh secret set WHEELS_ARTIFACTS_RUN_ID --body ${{ github.run_id }}
env:
GH_TOKEN: ${{ secrets.GH_PAT }}