-
Notifications
You must be signed in to change notification settings - Fork 562
368 lines (306 loc) · 9.59 KB
/
test-and-deploy.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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
name: "Test Python Lib"
on:
push:
branches:
- main
- devel
- deploy
pull_request:
release:
permissions:
contents: read
pull-requests: read
jobs:
test-windows:
strategy:
matrix:
os: [windows-latest]
python: ['3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install build dependencies
run: |
pip install setuptools
- name: Install lib
run: |
python setup.py develop
- name: Install test dependencies
run: |
pip install matplotlib
pip install pytest
- name: pytest
run: |
pytest GPy/testing
test-linux:
strategy:
matrix:
os: [ubuntu-latest]
python: ['3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install build dependencies
run: |
pip install setuptools
- name: Install lib
run: |
python setup.py develop
- name: Install test dependencies
run: |
pip install matplotlib
pip install pytest
- name: pytest
run: |
pytest GPy/testing
test-macos:
strategy:
matrix:
os: [macos-latest]
python: ['3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
pip install setuptools
- name: Install lib
run: |
python setup.py develop
- name: Install test dependencies
run: |
pip install matplotlib
pip install pytest
- name: pytest
run: |
pytest GPy/testing
build-windows:
# if: github.event_name == 'release'
strategy:
matrix:
os: [windows-latest]
python: ['3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Build lib
run: |
pip install setuptools
pip install wheel
python setup.py develop
python setup.py bdist_wheel
python setup.py sdist bdist_wheel
- name: List contents of dist
run: ls -R dist
- name: Archive build artifacts
uses: actions/upload-artifact@v3
with:
name: dist-artifacts-${{ matrix.os }}-${{ matrix.python }}
path: dist
build-macos:
# if: github.event_name == 'release'
strategy:
matrix:
os: [macos-latest]
python: ['3.10', '3.11', '3.12'] # 3.9 triggers scipy issues when installing
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Build lib
run: |
pip install setuptools
pip install wheel
python setup.py develop
python setup.py bdist_wheel
- name: List contents of dist
run: ls -R dist
- name: Archive build artifacts
uses: actions/upload-artifact@v3
with:
name: dist-artifacts-${{ matrix.os }}-${{ matrix.python }}
path: dist/*
build-linux:
# if: github.event_name == 'release'
strategy:
matrix:
python: ['cp39-cp39', 'cp310-cp310', 'cp311-cp311', 'cp312-cp312']
runs-on: ubuntu-latest
container:
image: quay.io/pypa/manylinux2014_x86_64
steps:
- name: Checkout
# uses: actions/checkout@v2
run: |
yum update
yum install -y git
git config --global --add safe.directory /__w/GPy/GPy
git clone --depth=1 https://github.com/${{ github.repository }}.git .
git checkout ${{ github.sha }}
- name: Install build dependencies
run: |
/opt/python/${{ matrix.python }}/bin/python -m pip install setuptools
- name: Compile c headers
run: |
/opt/python/${{ matrix.python }}/bin/python setup.py develop
- name: Build wheel files
run: |
/opt/python/${{ matrix.python }}/bin/python setup.py bdist_wheel
- name: Install auditwheel # this should be available?!
run: |
/opt/python/${{ matrix.python }}/bin/python -m pip install auditwheel
- name: Repair wheel files
run: |
/opt/python/${{ matrix.python }}/bin/python -m auditwheel repair dist/*${{ matrix.python }}-linux_x86_64.whl
- name: List contents of dist
run: ls -R dist
- name: List contests of wheelhouse
run: ls -R wheelhouse
- name: Move wheelhouse wheel files to dist
run: |
rm dist/*
mv wheelhouse/* dist/
rmdir wheelhouse
- name: List contents of dist
run: ls -R dist
- name: Upload artifact using curl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tar -czf dist-artifacts-linux-${{ matrix.python }}.tar.gz -C dist .
curl -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/zip" \
--data-binary @dist-artifacts-manylinux-${{ matrix.python }}.tar.gz \
"https://uploads.github.com/repos/${{ github.repository }}/actions/artifacts/${{ github.run_id }}/dist-artifacts-manylinux-${{ matrix.python }}?name=dist-artifacts-manylinux-${{ matrix.python }}.tar.gz"
with:
name: dist-artifacts-manylinux-${{ matrix.python }}
path: dist/*
# - name: Archive build artifacts
# uses: actions/upload-artifact@v1
# with:
# name: dist-artifacts-manylinux-${{ matrix.python }}
# path: dist/*
deploy-test:
runs-on: ubuntu-latest
needs: [test-windows, test-linux, test-macos, build-linux, build-windows, build-macos]
# if: github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install twine
run: |
pip install --upgrade pip
pip install twine
- name: Download all artifacts to a specific directory
uses: actions/download-artifact@v3
with:
path: dist
- name: List all downloaded artifacts
run: |
echo "Listing all downloaded artifacts:"
ls -lh dist
- name: Create dist directory
run: mkdir -p dist
- name: List tar files before extraction
run: |
echo "Listing all tar files before extraction:"
find dist -name "*.tar.gz"
- name: Extract tar.gz files
run: |
for artifact in dist/*; do
if [[ "$artifact" == *.tar.gz ]]; then
echo "Extracting $artifact"
tar -tzf "$artifact"
tar -xzf "$artifact" -C dist
rm "$artifact"
fi
done
- name: Inspect wheel files
run: |
ls -R dist
- name: Move files from subdirectories
run: |
for subdirectory in dist/*/; do
dir_name=$(basename "$subdirectory")
mv "$subdirectory"* dist/
rm -r "$subdirectory"
echo "Moved files from '$dir_name' to 'dist/'"
done
- name: Move files from subdirectories
run: |
for subdirectory in dist/*/; do
if [ -d "$subdirectory" ]; then
dir_name=$(basename "$subdirectory")
mv "$subdirectory"* dist/
rm -r "$subdirectory"
echo "Moved files from '$dir_name' to 'dist/'"
fi
done
- name: Inspect wheel files
run: |
ls -R dist
deploy:
runs-on: ubuntu-latest
needs: [test-windows, test-linux, test-macos, build-linux, build-windows, build-macos]
if: github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install twine
run: |
pip install --upgrade pip
pip install twine
- name: Download all artifacts to a specific directory
uses: actions/download-artifact@v3
with:
path: dist
- name: Create dist directory
run: mkdir -p dist
- name: Move files from subdirectories
run: |
for subdirectory in dist/*/; do
dir_name=$(basename "$subdirectory")
mv "$subdirectory"* dist/
rm -r "$subdirectory"
echo "Moved files from '$dir_name' to 'dist/'"
done
- name: Inspect wheel files
run: |
ls -R dist
- name: Upload to PyPI using twine
run: twine upload --skip-existing dist/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}