-
Notifications
You must be signed in to change notification settings - Fork 3
203 lines (193 loc) · 8.02 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
# 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:
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, ... installed in /opt/python/<python tag>-<abi tag>
container: quay.io/pypa/manylinux2014_x86_64
env: {ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true} # Allow using Node16 actions required for CentOS7
# We are now in CentOS 7 64 bits
steps:
- name: "Checkout the full project"
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 -- -y
# 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
# For secrets, see https://docs.github.com/en/actions/reference/encrypted-secrets
- name: "Build and run tests"
shell: bash
run: |
source $HOME/.cargo/env
for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do
"${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
python -m pytest -v
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@v4
# - 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"
uses: actions/checkout@v4
# 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@v4
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 x86_64-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
python -m pytest -v
# 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"
uses: actions/checkout@v4
# 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@v4
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
python -m pytest -v
deactivate
# Build the doc and run the tests in the doc (only for python 3.11 on ubuntu)
test-doc:
runs-on: ubuntu-latest
steps:
- name: "Checkout branch"
uses: actions/checkout@v4
- name: "Set up Python 3.11 on Ubuntu"
uses: actions/setup-python@v4
with:
python-version: '3.11'
- 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
sudo apt-get install pandoc
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