-
Notifications
You must be signed in to change notification settings - Fork 570
180 lines (153 loc) · 4.82 KB
/
Copy pathtest-and-deploy.yml
File metadata and controls
180 lines (153 loc) · 4.82 KB
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
name: "Test Python Lib"
on:
push:
branches:
- main
- devel
- deploy
pull_request:
release:
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ['3.11', '3.12', '3.13', '3.14']
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
pip install 'Cython>=0.29'
pip install 'numpy>=2,<3'
- name: Install lib
run: |
python -m pip install --editable .
- name: Install test dependencies
run: |
pip install matplotlib pytest
- name: pytest
run: |
pytest GPy/testing
build:
# if: github.event_name == 'release'
strategy:
matrix:
os: [windows-latest, macos-latest]
python: ['3.11', '3.12', '3.13', '3.14']
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
pip install 'Cython>=0.29'
pip install 'numpy>=2,<3'
python -m pip install --editable .
python setup.py bdist_wheel
- name: Build sdist (Windows only)
if: runner.os == 'Windows'
run: python setup.py sdist
- name: List contents of dist
run: ls -R dist
- name: Archive build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifacts-${{ matrix.os }}-${{ matrix.python }}
path: dist
build-linux:
# if: github.event_name == 'release'
strategy:
matrix:
python: ['cp311-cp311', 'cp312-cp312', 'cp313-cp313', 'cp314-cp314']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# manylinux2014 ships GCC 10.2.1; NumPy 2.5+ requires GCC >= 10.3 and
# no longer provides usable manylinux2014 wheels, so pip tries (and fails)
# to build NumPy from source there. manylinux_2_28 has a new enough toolchain.
- name: Build and repair wheel in manylinux container
run: |
docker run --rm \
-v "$PWD":/io \
-w /io \
quay.io/pypa/manylinux_2_28_x86_64 \
bash -euo pipefail -c "
PY=/opt/python/${{ matrix.python }}/bin/python
\"\$PY\" -m pip install --upgrade pip
\"\$PY\" -m pip install setuptools wheel 'Cython>=0.29' 'scipy>=1.3.0'
# Prefer binary NumPy wheels; never fall back to a source build.
\"\$PY\" -m pip install --only-binary=:all: 'numpy>=2,<3'
\"\$PY\" setup.py bdist_wheel
\"\$PY\" -m pip install auditwheel
\"\$PY\" -m auditwheel repair dist/*${{ matrix.python }}-linux_x86_64.whl
rm -f dist/*
mv wheelhouse/* dist/
rmdir wheelhouse
"
sudo chown -R "$USER:$USER" dist
- name: List contents of dist
run: ls -R dist
- name: Archive build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifacts-manylinux-${{ matrix.python }}
path: dist
deploy:
runs-on: ubuntu-latest
needs: [test, build-linux, build]
# if: github.event_name == 'release'
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install twine
run: |
pip install --upgrade pip
pip install twine
- name: Download all artifacts to a specific directory
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: List and verify artifact integrity
run: |
echo "Contents of dist directory:"
ls -lhR dist
# Verify all tar.gz files can be read
for file in dist/*.tar.gz; do
if [ -f "$file" ]; then
echo "Verifying $file..."
tar -tzf "$file" > /dev/null && echo "✓ $file is valid" || echo "✗ $file is corrupted"
fi
done
- name: Inspect wheel files
run: |
ls -R dist
- name: Verify distributions
run: twine check dist/*
- name: Upload to PyPI using twine
run: twine upload dist/*