forked from aio-libs/aiokafka
-
Notifications
You must be signed in to change notification settings - Fork 0
217 lines (195 loc) · 6.74 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
# 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.7
- name: Prepare C files to include
run: |
python -m pip install --upgrade pip setuptools
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 -Ue . # We set -vv to see compiler exceptions/warnings
- name: Build source package
run: python setup.py 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]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Build wheels
env:
CIBW_BUILD: cp36-* cp37-* cp38-* cp39-*
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 setuptools
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.6, 3.7, 3.8, 3.9]
include:
- python: 3.6
snappy_whl: tools/python_snappy-0.5.4-cp36-cp36m-win_amd64.whl
aiokafka_whl: dist/aiokafka-*-cp36-cp36m-win_amd64.whl
- python: 3.7
snappy_whl: tools/python_snappy-0.5.4-cp37-cp37m-win_amd64.whl
aiokafka_whl: dist/aiokafka-*-cp37-cp37m-win_amd64.whl
- python: 3.8
snappy_whl: tools/python_snappy-0.5.4-cp38-cp38-win_amd64.whl
aiokafka_whl: dist/aiokafka-*-cp38-cp38-win_amd64.whl
- python: 3.9
snappy_whl: tools/python_snappy-0.5.4-cp39-cp39-win_amd64.whl
aiokafka_whl: dist/aiokafka-*-cp39-cp39-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: |
pip install --upgrade pip setuptools wheel
pip install ${{ matrix.snappy_whl }}
pip install -r requirements-win-test.txt
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.6, 3.7, 3.8, 3.9]
include:
- python: 3.6
aiokafka_whl: dist/aiokafka-*-cp36-cp36m-macosx_10_9_x86_64.whl
- python: 3.7
aiokafka_whl: dist/aiokafka-*-cp37-cp37m-macosx_10_9_x86_64.whl
- 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
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: |
brew install snappy
- 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.6, 3.7, 3.8.5, 3.9]
include:
- python: 3.6
aiokafka_whl: dist/aiokafka-*-cp36-cp36m-manylinux*_x86_64.whl
- python: 3.7
aiokafka_whl: dist/aiokafka-*-cp37-cp37m-manylinux*_x86_64.whl
- python: 3.8.5
aiokafka_whl: dist/aiokafka-*-cp38-cp38-manylinux*_x86_64.whl
- python: 3.9
aiokafka_whl: dist/aiokafka-*-cp39-cp39-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
# FIXME 3.8.6 and 3.9.0 have broken `wait_for`
if: ${{ matrix.python != '3.9' }}
run: |
# Remove source code to be sure we use wheel code
rm -rf aiokafka
make ci-test-unit
deploy:
runs-on: ubuntu-latest
needs: [test-wheels-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 }}