-
Notifications
You must be signed in to change notification settings - Fork 234
269 lines (244 loc) · 8.62 KB
/
publish.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Publish
on:
release:
types: [created]
workflow_dispatch: {}
jobs:
package-source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Prepare C files to include
run: |
python -m pip install --upgrade pip build
python -m pip install -r requirements-cython.txt
# Make sure we install to have all c files to be shiped with bundle
python -m pip install -vv -U . # We set -vv to see compiler exceptions/warnings
- name: Build source package
run: python -m build --sdist
- name: Upload source package
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
package-wheel:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [auto]
include:
- os: ubuntu-latest
arch: aarch64
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Set up QEMU
if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v1
- name: Build wheels
env:
CIBW_ARCHS_LINUX: ${{matrix.arch}}
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
CIBW_SKIP: '*-musllinux*'
CIBW_BEFORE_BUILD_LINUX: pip install -r requirements-cython.txt && yum install -y zlib-devel
# On windows and mac we should have z library preinstalled
CIBW_BEFORE_BUILD: pip install -r requirements-cython.txt
CIBW_BUILD_VERBOSITY: 2
run: |
python -m pip install --upgrade pip
pip install cibuildwheel
cibuildwheel --output-dir dist
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
test-wheels-windows:
needs: [package-source, package-wheel]
runs-on: windows-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- python: "3.8"
aiokafka_whl: dist/aiokafka-*-cp38-cp38-win_amd64.whl
- python: "3.9"
aiokafka_whl: dist/aiokafka-*-cp39-cp39-win_amd64.whl
- python: "3.10"
aiokafka_whl: dist/aiokafka-*-cp310-cp310-win_amd64.whl
- python: "3.11"
aiokafka_whl: dist/aiokafka-*-cp311-cp311-win_amd64.whl
- python: "3.12"
aiokafka_whl: dist/aiokafka-*-cp312-cp312-win_amd64.whl
steps:
- uses: actions/checkout@v2
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist
path: dist/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements-win-test.txt
python -m pip install ${{ matrix.aiokafka_whl }}
shell: bash
- name: Run Unit Tests
run: |
# Remove source code to be sure we use wheel code
rm -rf aiokafka
make ci-test-unit
shell: bash
test-wheels-mac:
needs: [package-source, package-wheel]
runs-on: macos-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- python: "3.8"
aiokafka_whl: dist/aiokafka-*-cp38-cp38-macosx_10_9_x86_64.whl
- python: "3.9"
aiokafka_whl: dist/aiokafka-*-cp39-cp39-macosx_10_9_x86_64.whl
- python: "3.10"
aiokafka_whl: dist/aiokafka-*-cp310-cp310-macosx_10_9_x86_64.whl
- python: "3.11"
aiokafka_whl: dist/aiokafka-*-cp311-cp311-macosx_10_9_x86_64.whl
- python: "3.12"
aiokafka_whl: dist/aiokafka-*-cp312-cp312-macosx_10_9_x86_64.whl
steps:
- uses: actions/checkout@v2
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist
path: dist/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install python dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements-ci.txt
pip install ${{ matrix.aiokafka_whl }}
- name: Run Unit Tests
run: |
# Remove source code to be sure we use wheel code
rm -rf aiokafka
make ci-test-unit
test-wheels-linux:
needs: [package-source, package-wheel]
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- python: "3.8"
aiokafka_whl: dist/aiokafka-*-cp38-cp38-manylinux*_x86_64.whl
- python: "3.9"
aiokafka_whl: dist/aiokafka-*-cp39-cp39-manylinux*_x86_64.whl
- python: "3.10"
aiokafka_whl: dist/aiokafka-*-cp310-cp310-manylinux*_x86_64.whl
- python: "3.11"
aiokafka_whl: dist/aiokafka-*-cp311-cp311-manylinux*_x86_64.whl
- python: "3.12"
aiokafka_whl: dist/aiokafka-*-cp312-cp312-manylinux*_x86_64.whl
steps:
- uses: actions/checkout@v2
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist
path: dist/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsnappy-dev libzstd-dev libkrb5-dev
- name: Install python dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements-ci.txt
pip install ${{ matrix.aiokafka_whl }}
- name: Run Unit Tests
run: |
# Remove source code to be sure we use wheel code
rm -rf aiokafka
make ci-test-unit
test-wheels-aarch64-linux:
needs: [package-source, package-wheel]
runs-on: ubuntu-latest
env:
py: /opt/python/${{ matrix.pyver }}/bin/python
img: quay.io/pypa/manylinux2014_aarch64
strategy:
matrix:
include:
- pyver: cp38-cp38
aiokafka_whl: dist/aiokafka-*-cp38-cp38-manylinux*_aarch64.whl
- pyver: cp39-cp39
aiokafka_whl: dist/aiokafka-*-cp39-cp39-manylinux*_aarch64.whl
- pyver: cp310-cp310
aiokafka_whl: dist/aiokafka-*-cp310-cp310-manylinux*_aarch64.whl
- pyver: cp311-cp311
aiokafka_whl: dist/aiokafka-*-cp311-cp311-manylinux*_aarch64.whl
- pyver: cp312-cp312
aiokafka_whl: dist/aiokafka-*-cp312-cp312-manylinux*_aarch64.whl
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist
path: dist/
- name: Test Wheel
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
${{ env.img }} \
bash -exc '${{ env.py }} -m venv .env && \
source .env/bin/activate && \
yum install -y epel-release && \
yum-config-manager --enable epel && \
yum install -y krb5-devel && \
pip install --upgrade pip setuptools wheel && \
pip install -r requirements-ci.txt && \
pip install ${{ matrix.aiokafka_whl }} && \
rm -rf aiokafka && \
make ci-test-unit && \
deactivate'
deploy:
runs-on: ubuntu-latest
needs: [test-wheels-linux, test-wheels-aarch64-linux, test-wheels-mac, test-wheels-windows]
steps:
- uses: actions/checkout@v2
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}