-
Notifications
You must be signed in to change notification settings - Fork 2
159 lines (127 loc) · 4.86 KB
/
ci.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
name: CI
# by not building all branches on push, we avoid the duplicated builds in PRs
on:
push:
branches:
- main
tags:
- '**'
pull_request:
concurrency:
# cancel previous runs of the same workflow for the same PR when new commits are pushed
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
NUMBA_NUM_THREADS: 1
MPLBACKEND: Agg
PYTEST_ADDOPTS: --color=yes
jobs:
static-code-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: "3.11"
tests:
runs-on: [self-hosted, x64, Linux, ubuntu, generic]
strategy:
max-parallel: 1
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Install required packages
run: |
sudo apt-get -y install gcc
- name: Build the package
run: |
pip install build
python -m build
- name: Install the package
run: pip install .[test]
- name: Install the package in editable mode with all additional dependencies
run: pip install --editable .[all]
- name: Extract test data version from source code
env:
TEST_DATA_PASSWORD: ${{ secrets.test_data_password }}
run: |
export TESTDATA_MD5SUM=`grep 'TESTDATA_MD5SUM' ./tests/conftest.py | awk -F"'" '{print $2}' | tr -d '\n'`
echo "TESTDATA_MD5SUM=$TESTDATA_MD5SUM" >> $GITHUB_ENV
- name: Use mounted astrometry index files and test dataset
run: |
ln -s /mnt/astrometry_cache $HOME/.astrometry_cache
ln -s /mnt/test_datasets/iop4testdata.$TESTDATA_MD5SUM.tar.gz $HOME/iop4testdata.$TESTDATA_MD5SUM.tar.gz
- name: Check that index files and test dataset were correctly mounted
run: |
ls -lh $HOME/.astrometry_cache/5200/index-5200-00.fits
ls -lh $HOME/iop4testdata.$TESTDATA_MD5SUM.tar.gz
- name: Run tests (with -o log_cli=true -o log_cli_level=DEBUG to debug CI actions)
run: pytest -o log_cli=true -o log_cli_level=DEBUG -vxs tests
docs:
runs-on: [self-hosted, x64, Linux, ubuntu, generic]
# Don't run if this is a tag push, already done during docs deployment (docs.yml)
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
strategy:
max-parallel: 1
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Install required packages
run: |
sudo apt-get -y install pandoc make gcc
- name: Install doc dependencies
run: |
pip install -e .[doc]
python -c 'import iop4lib; print(iop4lib.__version__)'
- name: Extract test data version from source code
env:
TEST_DATA_PASSWORD: ${{ secrets.test_data_password }}
run: |
export TESTDATA_MD5SUM=`grep 'TESTDATA_MD5SUM' ./tests/conftest.py | awk -F"'" '{print $2}' | tr -d '\n'`
echo "TESTDATA_MD5SUM=$TESTDATA_MD5SUM" >> $GITHUB_ENV
- name: Use mounted astrometry index files and test dataset
run: |
ln -s /mnt/astrometry_cache $HOME/.astrometry_cache
ln -s /mnt/test_datasets/iop4testdata.$TESTDATA_MD5SUM.tar.gz $HOME/iop4testdata.$TESTDATA_MD5SUM.tar.gz
- name: Check that index files and test dataset were correctly mounted
run: |
ls -lh $HOME/.astrometry_cache/5200/index-5200-00.fits
ls -lh $HOME/iop4testdata.$TESTDATA_MD5SUM.tar.gz
- name: Extract test data in the default data folder
run: |
tar -xzf $HOME/iop4testdata.$TESTDATA_MD5SUM.tar.gz -C $HOME
mv $HOME/iop4testdata $HOME/.iop4data
- name: Create the DB
run: |
python iop4site/manage.py makemigrations
python iop4site/manage.py makemigrations iop4api
python iop4site/manage.py migrate --no-input
python iop4site/manage.py loaddata $HOME/.iop4data/testcatalog.yaml
ls -lh $HOME/.iop4data/
- name: Run iop4 on the test data
run: iop4 --list-local
- name: Build docs
run: make docs-sphinx