-
Notifications
You must be signed in to change notification settings - Fork 3
327 lines (313 loc) · 13.1 KB
/
test.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
# The starting point of this script are the links provided on the maturing doc:
# * https://github.com/nanoporetech/fast-ctc-decode/blob/b226ea0f2b2f4f474eff47349703d57d2ea4801b/.github/workflows/publish.yml
# * https://github.com/konstin/complex-manylinux-maturin-docker/blob/main/.github/workflows/build.yml
# Description of the usage of virtual env:
# * https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
name: test-cdshealpix
on: [push, workflow_dispatch]
# Jobs run in parallel, see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs
# Github hosted runner are: see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
jobs:
# Linux is specific because of manylinux, we have to use a docker file
test-linux64-wheels:
# Containers run in Linux
runs-on: ubuntu-latest
# Docker Hub image that 'build-linux-wheels' executes in.
# See https://github.com/pypa/manylinux for this particular container:
# * CPython 3.8, 3.9, 3.10, ... installed in /opt/python/<python tag>-<abi tag>
container: quay.io/pypa/manylinux2014_x86_64
# We are now in CentOS 7 64 bits
steps:
# Checkout the project
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# We need to install rust in the docker image (else, cargo is already available in github action)
- name: "Install Rust"
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Test Rust code
#- name: Run rust wrapper tests
# run: |
# source $HOME/.cargo/env
# cargo test --verbose -- --nocapture
# Build and install locally wheels for all pre-installed python version (in /opt/python/, see docker image comment)
# installing first maturin and using maturin: https://github.com/PyO3/maturin#pypy
- name: "Build and test wheels"
run: |
source $HOME/.cargo/env
for PYBIN in /opt/python/cp3[8910]*/bin; do
echo "Loop on PYBIN: $PYBIN"
# With maturin develop, we have to use virtualenv
"${PYBIN}/pip" install virtualenv
"${PYBIN}/virtualenv" cdshealpixenv
source cdshealpixenv/bin/activate
# No we are in the virtual env
pip install --upgrade pip
echo "INSTALL MATURIN"
pip install maturin
maturin -V
echo "MATURIN BUILD"
maturin build --release --compatibility manylinux2014
echo "MATURIN DEVELOP"
maturin develop --release
echo "INSTALL DEPENDENCIES"
pip install -r requirements-dev.txt
echo "PERFORM TESTS"
cd python
python -m pytest -v -s cdshealpix/tests/test_nested_healpix.py
python -m pytest -v -s cdshealpix/tests/test_ring_healpix.py
cd ..
echo "CLEAN"
pip freeze > requirements-uninstall.txt
pip uninstall -r requirements-uninstall.txt -y
deactivate
rm -r cdshealpixenv/
done
# # Linux is specific because of manylinux, we have to use a docker file
# test-linux32-wheels:
# # Containers run in Linux
# runs-on: ubuntu-latest
# # Docker Hub image that 'build-linux-wheels' executes in.
# # See https://github.com/pypa/manylinux for this particular container:
# # * CPython 3.8, 3.9, 3.10 ... installed in /opt/python/<python tag>-<abi tag>
# container: quay.io/pypa/manylinux2014_i686
# # We are now in CentOS 7 32 bits
# steps:
# # Checkout the project
# - name: "Checkout branch ${{ github.head_ref }}"
# uses: actions/checkout@v3
# # We need to install rust in the docker image (else, cargo is already available in github action)
# - name: "Install Rust"
# run: |
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-host i686-unknown-linux-gnu -y
# # Test Rust code
# #- name: Run rust wrapper tests
# # run: |
# # source $HOME/.cargo/env
# # cargo test --verbose -- --nocapture
# # Build wheels for all pre-installed python version (in /opt/python/, see docker image comment)
# # installing first maturin and using maturin: https://github.com/PyO3/maturin#pypy
# - name: "Build and test wheels"
# run: |
# source $HOME/.cargo/env
# for PYBIN in /opt/python/cp3[8910]*/bin; do
# echo "Loop on PYBIN: $PYBIN"
# # With maturin develop, we have to use virtualenv
# "${PYBIN}/pip" install virtualenv
# "${PYBIN}/virtualenv" cdshealpixenv
# source cdshealpixenv/bin/activate
# pip install --upgrade pip
# # No we are in the virtual env
# echo "INSTALL MATURIN"
# pip install maturin
# maturin -V
# echo "MATURIN DEVELOP"
# maturin build --release --compatibility manylinux2014 --target i686-unknown-linux-gnu
# echo "MATURIN DEVELOP"
# maturin develop --release --target i686-unknown-linux-gnu
# echo "INSTALL DEPENDENCIES"
# pip install -r requirements-dev.txt
# echo "PERFORM TESTS"
# python -m pytest -v -s cdshealpix/tests/test_nested_healpix.py
# python -m pytest -v -s cdshealpix/tests/test_ring_healpix.py
# echo "CLEAN"
# pip freeze > requirements-uninstall.txt
# pip uninstall -r requirements-uninstall.txt -y
# deactivate
# rm -r cdshealpixenv/
# done
test-linux32-wheels:
runs-on: ubuntu-latest
env:
img: quay.io/pypa/manylinux2014_i686
steps:
- name: Checkout
uses: actions/checkout@v3
- name: "Set up QEMU"
id: qemu
uses: docker/setup-qemu-action@v1
- name: Install dependencies
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
${{ env.img }} \
bash -exc 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
source $HOME/.cargo/env && \
for PYBIN in /opt/python/cp3[78910]*/bin; do
echo "Loop on PYBIN: $PYBIN"
"${PYBIN}/pip" install virtualenv
"${PYBIN}/virtualenv" cdshealpixenv
source cdshealpixenv/bin/activate
pip install --upgrade pip
pip install maturin
maturin build --release --compatibility manylinux2014
maturin develop --release
pip install -r requirements-dev.txt
cd python
python -m pytest -v -s cdshealpix/tests/test_nested_healpix.py
python -m pytest -v -s cdshealpix/tests/test_ring_healpix.py
cd ..
pip freeze > requirements-uninstall.txt
pip uninstall -r requirements-uninstall.txt -y
deactivate
rm -r cdshealpixenv/
done'
## So far desactivated because too long to build astropy wheels
#test-aarch64-wheels:
# runs-on: ubuntu-latest
# env:
# img: quay.io/pypa/manylinux2014_aarch64
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: "Set up QEMU"
# id: qemu
# uses: docker/setup-qemu-action@v1
# - name: Install dependencies
# run: |
# docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
# ${{ env.img }} \
# bash -exc 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-host aarch64-unknown-linux-gnu -y && \
# source $HOME/.cargo/env && \
# for PYBIN in /opt/python/cp3[78910]*/bin; do
# echo "Loop on PYBIN: $PYBIN"
# "${PYBIN}/pip" install virtualenv
# "${PYBIN}/virtualenv" cdshealpixenv
# source cdshealpixenv/bin/activate
# pip install --upgrade pip
# pip install maturin
# cargo build --release --config "net.git-fetch-with-cli = true"
# maturin build --release --compatibility manylinux2014 --target aarch64-unknown-linux-gnu --config "net.git-fetch-with-cli = true"
# maturin develop --release --target aarch64-unknown-linux-gnu --config "net.git-fetch-with-cli = true"
# pip install -r requirements-dev.txt
# cd python
# python -m pytest -v -s cdshealpix/tests/test_nested_healpix.py
# python -m pytest -v -s cdshealpix/tests/test_ring_healpix.py
# cd ..
# pip freeze > requirements-uninstall.txt
# pip uninstall -r requirements-uninstall.txt -y
# deactivate
# rm -r cdshealpixenv/
# done'
test-macos-wheels:
runs-on: macos-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
# Checkout the project
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# Test Rust code
#- name: Run rust wrapper tests
# run: cargo test --verbose -- --nocapture
# Set up python, see https://docs.github.com/en/actions/guides/building-and-testing-python
- name: "Set up Python ${{ matrix.python-version }} on MacOS"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# Test python code
- name: "Build and test wheel for Python ${{ matrix.python-version }} on MacOS"
run: |
# Install, create and activate a python virtualenv
rustup target add aarch64-apple-darwin
pip install virtualenv
virtualenv cdshealpixenv
source cdshealpixenv/bin/activate
# Install and use maturin
pip install --upgrade pip
pip install maturin
maturin -V
maturin build --release --target universal2-apple-darwin
maturin develop --release
# Install dependencies
pip install -r requirements-dev.txt
# Run tests
cd python
python -m pytest -v -s cdshealpix/tests/test_nested_healpix.py
python -m pytest -v -s cdshealpix/tests/test_ring_healpix.py
cd ..
# Clean
#pip freeze > requirements-uninstall.txt
#pip uninstall -r requirements-uninstall.txt -y
deactivate
#rm -r cdshealpixenv/
test-windows-wheels:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
# Checkout the project
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# Test Rust code
#- name: Run rust wrapper tests
# run: cargo test --verbose -- --nocapture
# Set up python, see https://docs.github.com/en/actions/guides/building-and-testing-python
- name: "Set up Python ${{ matrix.python-version }} on Windows"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# Test python code
- name: "Build and test wheel for Python ${{ matrix.python-version }} on Windows"
run: |
# Install, create and activate a python virtualenv
# See: https://mothergeo-py.readthedocs.io/en/latest/development/how-to/venv-win.html
pip install virtualenv
virtualenv cdshealpixenv
.\cdshealpixenv\Scripts\activate
pip install --upgrade pip
# Install and use maturin
pip install maturin
maturin -V
maturin develop --release
# Install dependencies
pip install -r requirements-dev.txt
# Run tests
cd python
python -m pytest -v "cdshealpix\tests\test_nested_healpix.py"
python -m pytest -v "cdshealpix\tests\test_ring_healpix.py"
cd ..
deactivate
# Build the doc and run the tests in the doc (only for python 3.9 on ubuntu)
test-doc:
runs-on: ubuntu-latest
steps:
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: "Set up Python 3.9 on Ubuntu"
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: "Build and test doc"
run: |
# Install virtualenv
pip install virtualenv
# Create and activate a new virtualenv
virtualenv cdshealpixenv
source cdshealpixenv/bin/activate
# Install maturin
pip install --upgrade pip
pip install maturin
maturin -V
# Build and install cdshealpix
maturin develop --release
# Install dependencies needed to build the docs
pip install -r requirements-doc.txt
# Compile the docs and run the test examples
cd ./docs
# * Generate the HTML files
make html
# * Run the API test examples
make doctest
cd ..
# Switch of the virtualenv
deactivate