6
6
upload :
7
7
description : ' Upload to PyPI'
8
8
type : boolean
9
+ required : false
9
10
default : false
10
11
11
12
python-version :
12
- description : ' Python version to run against'
13
- required : true
13
+ description : ' Python version to run on'
14
14
type : string
15
- default : " 1.13"
15
+ required : true
16
+ default : " 3.13"
16
17
17
18
target :
18
- type : string
19
19
description : " target os to build for: linux,macos,windows"
20
- default : " linux,macos,windows"
21
-
22
- cibw-skip :
23
20
type : string
24
- description : ' CIBUILDWHEEL builds pattern to skip, goes to CIBW_SKIP env'
25
21
required : false
26
- default : ' cp36* cp37* pp*i686 *musllinux*'
27
-
28
- env :
29
- CIBW_TEST_COMMAND_LINUX : >
30
- pytest {project}/tests/unit &&
31
- EVENT_LOOP_MANAGER=gevent pytest {project}/tests/unit/io/test_geventreactor.py
32
-
33
- CIBW_TEST_COMMAND_MACOS : " pytest {project}/tests/unit -k 'not (test_multi_timer_validation or test_empty_connections or test_timer_cancellation)' "
34
- CIBW_TEST_COMMAND_WINDOWS : " pytest {project}/tests/unit -k \" not (test_deserialize_date_range_year or test_datetype or test_libevreactor)\" "
35
- CIBW_BEFORE_TEST : " pip install -r {project}/test-requirements.txt"
36
- CIBW_BEFORE_BUILD_LINUX : " rm -rf ~/.pyxbld && rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux && yum install -y libffi-devel libev libev-devel openssl openssl-devel"
37
- CIBW_ENVIRONMENT : " CASS_DRIVER_BUILD_CONCURRENCY=2 CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST=yes CFLAGS='-g0 -O3'"
38
- CIBW_SKIP : cp36* cp37* pp*i686 *musllinux*
39
- CIBW_MANYLINUX_X86_64_IMAGE : manylinux_2_28
40
- CIBW_MANYLINUX_PYPY_X86_64_IMAGE : manylinux_2_28
41
- CIBW_MANYLINUX_AARCH64_IMAGE : manylinux_2_28
42
- CIBW_MANYLINUX_PYPY_AARCH64_IMAGE : manylinux_2_28
22
+ default : " linux,macos-x86,macos-arm,windows,linux-aarch64"
43
23
44
24
jobs :
45
25
prepare-matrix :
@@ -53,19 +33,27 @@ jobs:
53
33
run : |
54
34
echo -n "[" > /tmp/matrix.json
55
35
was_added=""
56
- for os in $(echo "${{ inputs.target }}" | tr -d " " | tr "," "\n")
36
+ for target in $(echo "${{ inputs.target }}" | tr -d " " | tr "," "\n")
57
37
do
58
- if [[ "${os}" == "linux" ]]; then
38
+ if [[ "${target}" == "linux" ]]; then
39
+ [ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
40
+ echo -n '{"os":"ubuntu-20.04", "target": "linux"}' >> /tmp/matrix.json
41
+ was_added=1
42
+ elif [[ "${target}" == "linux-aarch64" ]]; then
59
43
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
60
- echo -n '{"os":"ubuntu-20.04","platform":"x86_64"},{"os":"ubuntu-20.04","platform":"PyPy "}' >> /tmp/matrix.json
44
+ echo -n '{"os":"ubuntu-20.04", "target": "linux-aarch64 "}' >> /tmp/matrix.json
61
45
was_added=1
62
- elif [[ "${os }" == "windows" ]]; then
46
+ elif [[ "${target }" == "windows" ]]; then
63
47
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
64
- echo -n '{"os":"windows-latest","platform":"win64"},{"os":" windows-latest","platform":"PyPy "}' >> /tmp/matrix.json
48
+ echo -n '{"os":"windows-2022", "target": " windows"}' >> /tmp/matrix.json
65
49
was_added=1
66
- elif [[ "${os }" == "macos" ]]; then
50
+ elif [[ "${target }" == "macos-x86 " ]]; then
67
51
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
68
- echo -n '{"os":"macos-latest","platform":"all"},{"os":"macos-13","platform":"all"},{"os":"macos-latest","platform":"PyPy"}' >> /tmp/matrix.json
52
+ echo -n '{"os":"macos-13", "target": "macos-x86"}' >> /tmp/matrix.json
53
+ was_added=1
54
+ elif [[ "${target}" == "macos-arm" ]]; then
55
+ [ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
56
+ echo -n '{"os":"macos-14", "target": "macos-arm"}' >> /tmp/matrix.json
69
57
was_added=1
70
58
fi
71
59
done
@@ -74,32 +62,13 @@ jobs:
74
62
echo "matrix=$(cat /tmp/matrix.json)" >> $GITHUB_OUTPUT
75
63
76
64
build-wheels :
77
- name : Build wheels ${{ matrix.os }} ( ${{ matrix.platform }})
65
+ name : Build wheels for ${{ matrix.target }} on ${{ matrix.os }}
78
66
runs-on : ${{ matrix.os }}
67
+ needs : prepare-matrix
79
68
strategy :
80
69
fail-fast : false
81
70
matrix :
82
- include :
83
- - os : ubuntu-24.04
84
- platform : x86_64
85
-
86
- - os : ubuntu-24.04
87
- platform : PyPy
88
-
89
- - os : windows-2022
90
- platform : win64
91
-
92
- - os : windows-latest
93
- platform : PyPy
94
-
95
- - os : macos-14
96
- platform : all
97
-
98
- - os : macos-13
99
- platform : all
100
-
101
- - os : macos-latest
102
- platform : PyPy
71
+ include : ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
103
72
104
73
steps :
105
74
- uses : actions/checkout@v4
@@ -122,13 +91,20 @@ jobs:
122
91
- name : Install OpenSSL for Windows
123
92
if : runner.os == 'Windows'
124
93
run : |
125
- choco install openssl --version=3.4.1 -f -y
94
+ choco install openssl --version=3.4.1 -f -y --no-progress
95
+
96
+ - name : Set up QEMU
97
+ if : matrix.target == 'linux-aarch64'
98
+ uses : docker/setup-qemu-action@v3
99
+ with :
100
+ platforms : all
101
+ image : ' docker.io/tonistiigi/binfmt:desktop-v8.1.5'
126
102
127
103
- name : Install Conan
128
104
if : runner.os == 'Windows'
129
105
uses : turtlebrowser/get-conan@main
130
106
131
- - name : configure libev for Windows
107
+ - name : Configure libev for Windows
132
108
if : runner.os == 'Windows'
133
109
run : |
134
110
conan profile detect
@@ -139,57 +115,31 @@ jobs:
139
115
run : |
140
116
brew install libev
141
117
142
- - name : Overwrite for Linux 64
143
- if : runner.os == 'Linux' && matrix.platform == 'x86_64'
144
- run : |
145
- echo "CIBW_BUILD=cp3*_x86_64" >> $GITHUB_ENV
146
-
147
- - name : Overwrite for Linux PyPy
148
- if : runner.os == 'Linux' && matrix.platform == 'PyPy'
118
+ - name : Overwrite for MacOS
119
+ if : runner.os == 'MacOS'
149
120
run : |
150
- echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
151
- echo "CIBW_TEST_COMMAND_LINUX=" >> $GITHUB_ENV
152
-
153
- - name : Overwrite for Windows 64
154
- if : runner.os == 'Windows' && matrix.platform == 'win64'
155
- run : |
156
- echo "CIBW_BUILD=cp*win_amd64" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
157
- echo "CIBW_ENVIRONMENT_WINDOWS= CC=clang CXX=clang++" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
158
-
159
- - name : Overwrite for Windows PyPY
160
- if : runner.os == 'Windows' && matrix.platform == 'PyPy'
161
- run : |
162
- echo "CIBW_BUILD=pp*" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
163
- echo "CIBW_TEST_COMMAND_WINDOWS=" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
164
-
165
- - name : Overwrite for MacOs
166
- if : runner.os == 'MacOs' && matrix.platform == 'all'
167
- run : |
168
- echo "CIBW_BUILD=cp39* cp310* cp311* cp312* cp313*" >> $GITHUB_ENV
169
- echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
121
+ ##### Set MACOSX_DEPLOYMENT_TARGET
170
122
if [ "${{ matrix.os }}" == "macos-13" ]; then
171
123
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV;
172
124
echo "Enforcing target deployment for 13.0"
173
125
elif [ "${{ matrix.os }}" == "macos-14" ]; then
174
126
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV;
175
127
echo "Enforcing target deployment for 14.0"
176
- else
177
- echo "Unknown macos version" && false;
178
128
fi
179
- - name : Overwrite for MacOs PyPy
180
- if : runner.os == 'MacOs' && matrix.platform == 'PyPy'
181
- run : |
182
- echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
183
- echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
184
- echo "CIBW_TEST_COMMAND_MACOS=" >> $GITHUB_ENV
185
129
186
130
- name : Build wheels
131
+ if : matrix.target != 'linux-aarch64'
187
132
run : |
188
133
python3 -m cibuildwheel --output-dir wheelhouse
189
134
135
+ - name : Build wheels for linux aarch64
136
+ if : matrix.target == 'linux-aarch64'
137
+ run : |
138
+ CIBW_BUILD='cp3*' python -m cibuildwheel --archs aarch64 --output-dir wheelhouse
139
+
190
140
- uses : actions/upload-artifact@v4
191
141
with :
192
- name : wheels-${{ matrix.os }}-${{ matrix.platform }}
142
+ name : wheels-${{ matrix.target }}-${{ matrix.os }}
193
143
path : ./wheelhouse/*.whl
194
144
195
145
build-sdist :
@@ -211,56 +161,13 @@ jobs:
211
161
name : source-dist
212
162
path : dist/*.tar.gz
213
163
214
- build-wheels-extra-arch :
215
- # The host should always be linux
216
- runs-on : ubuntu-24.04
217
- name : Build extra arch ${{ matrix.archs }} wheels
218
- strategy :
219
- fail-fast : false
220
- matrix :
221
- archs : [ aarch64,] # ppc64le ]
222
-
223
- steps :
224
- - uses : actions/checkout@v4
225
-
226
- - name : Set up QEMU
227
- id : qemu
228
- uses : docker/setup-qemu-action@v3
229
- with :
230
- platforms : all
231
- image : ' docker.io/tonistiigi/binfmt:desktop-v8.1.5'
232
- if : runner.os == 'Linux'
233
-
234
- - uses : actions/setup-python@v5
235
- name : Install Python
236
- with :
237
- python-version : ${{ inputs.python-version }}
238
-
239
- - name : Install cibuildwheel
240
- run : |
241
- python -m pip install cibuildwheel==2.22.0
242
-
243
- - name : Build wheels
244
- env :
245
- CIBW_BUILD : " cp39* cp310* cp311* cp312* cp313*" # limit to specific version since it take much more time than jobs limit
246
- run : |
247
- python -m cibuildwheel --archs ${{ matrix.archs }} --output-dir wheelhouse
248
-
249
- - uses : actions/upload-artifact@v4
250
- with :
251
- name : wheels-${{ matrix.archs }}
252
- path : ./wheelhouse/*.whl
253
-
254
164
upload_pypi :
255
165
if : inputs.upload
256
- needs : [build-wheels, build-wheels-extra-arch, build- sdist]
166
+ needs : [build-wheels, build-sdist]
257
167
runs-on : ubuntu-24.04
258
168
permissions :
259
169
id-token : write
260
170
261
- # upload to PyPI on every tag starting with 'v'
262
- # alternatively, to publish when a GitHub Release is created, use the following rule:
263
- # if: github.event_name == 'release' && github.event.action == 'published'
264
171
steps :
265
172
- uses : actions/download-artifact@v4
266
173
with :
0 commit comments