-
Notifications
You must be signed in to change notification settings - Fork 7
318 lines (283 loc) · 10.1 KB
/
build.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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
name: setuptools-dso
on: [push, pull_request, workflow_dispatch]
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
name: Test ${{ matrix.python-version }} / ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.x"]
exclude:
# GHA doesn't list 3.6 for ubuntu-22.04
- os: ubuntu-latest
python-version: "3.6"
# MacOS 14.4.1 for arm64 doesn't support Python < 3.8
- os: macos-latest
python-version: "3.6"
- os: macos-latest
python-version: "3.7"
include:
# GHA doesn't list 3.6 for ubuntu-22
- os: ubuntu-20.04
python-version: "3.6"
# MacOS 13 required for Python < 3.8
- os: macos-13
python-version: "3.6"
- os: macos-13
python-version: "3.7"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Prepare
run: |
set -x
which python
python --version
python -m pip install -U pip
python -m pip --version
- name: Deps
shell: bash
run: |
set -x
pip download -d dist setuptools wheel nose2 cython
python -m pip install -v --no-index -f dist setuptools wheel nose2 cython
python -m nose2 -h
- name: Build/Install
shell: bash
run: |
set -x
python setup.py sdist --formats=gztar
ls dist
# build from source tar to ensure completeness
python -m pip install -v --no-index -f dist setuptools_dso
- name: Test
shell: bash
run: |
set -x
python -m setuptools_dso.probe
python -m nose2 setuptools_dso
- name: Test Example wheel
shell: bash
run: |
set -x
ls dist
cd example
python setup.py clean -a
git clean -fdx .
python -m pip install -v --no-index -f ../dist .
cd project2
# install project2.
# --no-build-isolation is needed so that ^^^ installed dsodemo could be found.
# --no-use-pep517 is used to workaround https://github.com/pypa/setuptools/issues/1694 on py36 and py35
python -m pip install -v --no-index -f ../dist wheel # needed by vvv
python -m pip install -v --no-index --no-build-isolation --no-use-pep517 -f ../../dist .
cd ../..
python -m dsodemo.cli
python -m nose2 dsodemo
python -m use_dsodemo.cli
- name: Test Example inplace
shell: bash
run: |
set -x
cd example
python setup.py clean -a
git clean -fdx .
export PYTHONPATH="`pwd`/src"
python setup.py -v build_dso -i
python setup.py -v build_dso -i -f # incremental recompile
python setup.py -v build_ext -i
cd project2
python setup.py -v build_ext -i
cd ../..
python -m dsodemo.cli
(cd example/project2/src && python -m use_dsodemo.cli)
- name: Test Example DSO only
shell: bash
run: |
set -x
cd example
python setup.py clean -a
git clean -fdx .
rm -f dist/*.whl
python setup-dso-only.py -v bdist_wheel
python -m wheel unpack -d junk dist/*.whl
find junk
ls junk/*/*.dist-info/WHEEL
! ls junk/*/*/purelib
- name: Test Namespace Packages with conventional install
shell: bash
run: |
set -x
cd example/namespaces
cd package-core && python setup.py clean -a && cd ..
cd package-dso && python setup.py clean -a && cd ..
git clean -fdx .
rm -rf */dist */build */*.egg-info
cd package-core && python -m pip install -v --no-build-isolation --no-index . && cd ..
cd package-dso && python -m pip install -v --no-build-isolation --no-index . && cd ..
cd ../..
python -c "import testnsp.testcore"
python -c "import testnsp.testdso"
python -c "import testnsp.testdso.thepyd"
- name: Test Namespace Packages with editable install
shell: bash
run: |
set -x
cd example/namespaces
cd package-core && python setup.py clean -a && cd ..
cd package-dso && python setup.py clean -a && cd ..
git clean -fdx .
rm -rf */dist */build */*.egg-info
cd package-core && python -m pip install -v --no-build-isolation --no-index -e . && cd ..
cd package-dso && python -m pip install -v --no-build-isolation --no-index -e . && cd ..
cd ../..
python -c "import testnsp.testcore"
python -c "import testnsp.testdso"
python -c "import testnsp.testdso.thepyd"
manylinux:
runs-on: ubuntu-latest
name: Test ${{ matrix.pyver }} / ${{ matrix.manylinux }}_${{ matrix.piparch }}
strategy:
fail-fast: false
matrix:
manylinux: ["manylinux1", "manylinux2010", "manylinux2014"]
piparch: ["i686", "x86_64"]
pyver: ["cp27-cp27m", "cp27-cp27mu", "cp36-cp36m", "cp37-cp37m", "cp38-cp38", "cp39-cp39", "cp310-cp310", "cp311-cp311", "cp312-cp312"]
exclude:
# manylinux1 doesn't include py >= 3.10
- manylinux: "manylinux1"
piparch: "i686"
pyver: "cp310-cp310"
- manylinux: "manylinux1"
piparch: "x86_64"
pyver: "cp310-cp310"
- manylinux: "manylinux1"
piparch: "i686"
pyver: "cp311-cp311"
- manylinux: "manylinux1"
piparch: "x86_64"
pyver: "cp311-cp311"
- manylinux: "manylinux1"
piparch: "i686"
pyver: "cp312-cp312"
- manylinux: "manylinux1"
piparch: "x86_64"
pyver: "cp312-cp312"
# manylinux2010 and above don't provide 2.7 in images
- manylinux: "manylinux2010"
piparch: "i686"
pyver: "cp27-cp27m"
- manylinux: "manylinux2010"
piparch: "i686"
pyver: "cp27-cp27mu"
- manylinux: "manylinux2010"
piparch: "x86_64"
pyver: "cp27-cp27m"
- manylinux: "manylinux2010"
piparch: "x86_64"
pyver: "cp27-cp27mu"
- manylinux: "manylinux2014"
piparch: "i686"
pyver: "cp27-cp27m"
- manylinux: "manylinux2014"
piparch: "i686"
pyver: "cp27-cp27mu"
- manylinux: "manylinux2014"
piparch: "x86_64"
pyver: "cp27-cp27m"
- manylinux: "manylinux2014"
piparch: "x86_64"
pyver: "cp27-cp27mu"
# manylinux2010 doesn't include pip with >= 3.11
- manylinux: "manylinux2010"
piparch: "i686"
pyver: "cp311-cp311"
- manylinux: "manylinux2010"
piparch: "x86_64"
pyver: "cp311-cp311"
- manylinux: "manylinux2010"
piparch: "i686"
pyver: "cp312-cp312"
- manylinux: "manylinux2010"
piparch: "x86_64"
pyver: "cp312-cp312"
steps:
- uses: actions/checkout@v4
- name: Test
run: |
# can't use GHA native docker support since GHA magic binaries need .so absent from old manylinux images :(
cat <<EOF > runit.sh
#!/bin/sh
set -e -x
ls /opt/python/*/bin/python
cd /io
export PATH="/opt/python/${{ matrix.pyver }}/bin:\$PATH"
which python
python -m pip download -d dist setuptools wheel nose2
python -m pip install -v --no-index -f dist setuptools wheel nose2
python setup.py sdist --formats=gztar
python -m pip wheel -v --no-index -w dist -f dist setuptools_dso
export SETUPTOOLS_DSO_PLAT_NAME="${{ matrix.manylinux }}_${{ matrix.piparch }}"
python -m pip install -v --no-index -f dist setuptools_dso
python -m setuptools_dso.probe
python -m nose2 setuptools_dso
cd example
python setup.py sdist -d ../dist --formats=gztar
cd ..
ls dist
python -m pip install -f dist --no-index dsodemo
cd dist
python -m dsodemo.cli
python -m nose2 dsodemo
EOF
cat runit.sh
chmod +x runit.sh
docker pull quay.io/pypa/${{ matrix.manylinux }}_${{ matrix.piparch }}
docker run --rm -v `pwd`:/io quay.io/pypa/${{ matrix.manylinux }}_${{ matrix.piparch }} ${{ matrix.pre }} /io/runit.sh
upload:
runs-on: ubuntu-latest
needs: [test, manylinux]
name: Upload
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
twine -h
- name: setup.py sdist
shell: bash
run: |
echo "Event: ${{ github.event_name }}"
echo "Ref: ${{ github.ref }}"
set -x
python -m pip install -U pip
python -m pip install setuptools wheel
python setup.py sdist
python -m pip wheel -w dist dist/setuptools_dso-*.tar.*
ls dist/setuptools_dso-*
tar -taf dist/setuptools_dso-*.tar.*
- name: Save
uses: actions/upload-artifact@v3
with:
name: artifacts
path: dist/setuptools_dso-*
- name: Upload
if: startsWith(github.ref, 'refs/tags/')
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/setuptools_dso-*