forked from sqlalchemy/sqlalchemy
-
Notifications
You must be signed in to change notification settings - Fork 0
216 lines (185 loc) · 6.98 KB
/
create-wheels.yaml
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
name: Create wheel
on:
release:
types: [created]
env:
PYTHONNOUSERSITE: 1
# comment TWINE_REPOSITORY_URL to use the real pypi. NOTE: change also the secret used in TWINE_PASSWORD
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
jobs:
# Two jobs are defined make-wheel-win-osx and make-wheel-linux.
# They do the the same steps, but linux wheels need to be build to target manylinux
make-wheel-win-osx:
name: ${{ matrix.python-version }}-${{ matrix.architecture }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- 'windows-latest'
- 'macos-latest'
python-version:
- '2.7'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
architecture:
- x64
- x86
include:
- python-version: '2.7'
extra-requires: 'mock'
exclude:
- os: 'macos-latest'
architecture: x86
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Create wheel
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip wheel -w dist --no-use-pep517 -v .
- name: Install wheel
run: |
pip install -f dist --no-index sqlalchemy
- name: Check c extensions
# on windows in python 2.7 and 3.5 the cextension fail to build.
# for python 2.7 visual studio 9 is missing
# for python 3.5 the linker has an error "cannot run 'rc.exe'"
if: matrix.os != 'windows-latest' || ( matrix.python-version != '2.7' && matrix.python-version != '3.5' )
run: |
python -c 'from sqlalchemy import cprocessors, cresultproxy, cutils'
- name: Test created wheel
run: |
pip install pytest pytest-xdist ${{ matrix.extra-requires }}
pytest -n2 -q test -k 'not MockReconnectTest' --nomemory
- name: Get wheel name
id: wheel-name
shell: bash
# creates output from https://github.saobby.my.eu.orgmunity/t5/GitHub-Actions/Using-the-output-of-run-inside-of-if-condition/td-p/33920
run: |
echo ::set-output name=wheel::`ls dist`
- name: Upload wheel to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/${{ steps.wheel-name.outputs.wheel }}
asset_name: ${{ steps.wheel-name.outputs.wheel }}
asset_content_type: application/zip # application/octet-stream
- name: Set up Python for twine
# twine on py2 is very old.
# the action https://github.com/marketplace/actions/python-wheels-manylinux-build runs only on linux
uses: actions/setup-python@v1
with:
python-version: '3.8'
- name: Publish wheel
env:
TWINE_USERNAME: __token__
# replace TWINE_PASSWORD with token for real pypi
TWINE_PASSWORD: ${{ secrets.test_pypi_token }}
run: |
pip install -U twine
twine upload --skip-existing dist/*
make-wheel-linux:
name: ${{ matrix.python-version }}-${{ matrix.architecture }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- 'ubuntu-latest'
python-version:
- '2.7'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
architecture:
- x64
include:
- python-version: '2.7'
extra-requires: 'mock'
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Create python PEP 425 tag for manylinux build
id: linux-py-version
env:
pyversion: ${{ matrix.python-version }}
run: |
pv="${pyversion/./}"
[ "$pv" -lt "38" ] && end=m || end=''
pytag="cp${pv}-cp${pv}$end"
echo $pytag
echo "::set-output name=python-version::$pytag"
- name: Create wheel for manylinux
uses: RalfG/python-wheels-manylinux-build@v0.2.2-manylinux2010_x86_64
# this generates 3 wheels in wheelhouse/. linux, manylinux1 and manylinux2010
with:
python-versions: ${{ steps.linux-py-version.outputs.python-version }}
build-requirements: 'setuptools wheel'
pip-wheel-args: '--no-use-pep517 -v --no-deps'
- name: Install wheel
run: |
pip install -f wheelhouse --no-index sqlalchemy
- name: Check c extensions
run: |
python -c 'from sqlalchemy import cprocessors, cresultproxy, cutils'
- name: Test created wheel
run: |
pip install pytest pytest-xdist ${{ matrix.extra-requires }}
pytest -n2 -q test -k 'not MockReconnectTest' --nomemory
- name: Get wheel names
id: wheel-name
shell: bash
# creates output from https://github.saobby.my.eu.orgmunity/t5/GitHub-Actions/Using-the-output-of-run-inside-of-if-condition/td-p/33920
run: |
cd wheelhouse
echo ::set-output name=wheel1::`ls *manylinux1*`
echo ::set-output name=wheel2010::`ls *manylinux2010*`
- name: Upload wheel manylinux1 to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: wheelhouse/${{ steps.wheel-name.outputs.wheel1 }}
asset_name: ${{ steps.wheel-name.outputs.wheel1 }}
asset_content_type: application/zip # application/octet-stream
- name: Upload wheel manylinux2010 to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: wheelhouse/${{ steps.wheel-name.outputs.wheel2010 }}
asset_name: ${{ steps.wheel-name.outputs.wheel2010 }}
asset_content_type: application/zip # application/octet-stream
- name: Set up Python for twine
# twine on py2 is very old.
# the action https://github.com/marketplace/actions/python-wheels-manylinux-build runs only on linux
uses: actions/setup-python@v1
with:
python-version: '3.8'
- name: Publish wheel
env:
TWINE_USERNAME: __token__
# replace TWINE_PASSWORD with token for real pypi
TWINE_PASSWORD: ${{ secrets.test_pypi_token }}
run: |
pip install -U twine
twine upload --skip-existing wheelhouse/*manylinux*