-
Notifications
You must be signed in to change notification settings - Fork 31
130 lines (108 loc) · 3.6 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
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
jobs:
test:
name: Test
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
monet: [cf, dev]
fail-fast: false # always both
steps:
- uses: actions/checkout@v4
- name: Set up Python (micromamba)
uses: mamba-org/setup-micromamba@v1
with:
environment-file: docs/environment-docs.yml
cache-environment: true
create-args: >-
pytest
- if: ${{ matrix.monet == 'dev' }}
name: Install development versions of monet and monetio
run: |
python -m pip list | grep monet
python -m pip install --force-reinstall --no-deps https://github.com/noaa-oar-arl/monetio/archive/develop.zip
python -m pip install --force-reinstall --no-deps https://github.com/noaa-oar-arl/monet/archive/develop.zip
- name: Versions
run: |
which python
python -m pip list | grep monet
micromamba list | grep monet
python -c "import monetio; print('monetio.__version__', getattr(monetio, '__version__', '?'))"
python -c "import monet; print('monet.__version__', getattr(monet, '__version__', '?'))"
- name: pytest
run: python -m pytest -v -rsx melodies_monet
- name: Run docs/examples notebooks as scripts
run: |
cd docs/examples
for f in *.ipynb; do
if [ "$f" == 'idealized.ipynb' ]; then
jupytext --to py $f -o t.py && python t.py || exit 1
fi
done
cd -
- name: Prepare idealized save/read cases
shell: python
run: |
from copy import deepcopy
import yaml
with open('docs/examples/control_idealized.yaml') as f:
ctl = yaml.safe_load(f)
assert {'save', 'read'} < ctl['analysis'].keys()
ctl_save = deepcopy(ctl)
del ctl_save['analysis']['read']
with open('docs/examples/control_idealized_save.yaml', 'w') as f:
yaml.safe_dump(ctl_save, f)
ctl_read = deepcopy(ctl)
del ctl_read['analysis']['save']
with open('docs/examples/control_idealized_read.yaml', 'w') as f:
yaml.safe_dump(ctl_read, f)
- name: Check CLI works
run: |
cd docs/examples
melodies-monet --version
python -m melodies_monet --version
melodies-monet run control_idealized_save.yaml
melodies-monet run control_idealized_read.yaml
cd -
docs:
name: Check docs build
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up Python (micromamba)
uses: mamba-org/setup-micromamba@v1
with:
environment-file: docs/environment-docs.yml
cache-environment: true
- name: linkcheck
run: sphinx-build -b linkcheck docs docs/_build/linkcheck
- name: sphinx-build -W
run: sphinx-build -b html -W docs docs/_build/html
- name: Check Sphinx failure log
if: ${{ failure() }}
run: |
if [ -e /tmp/sphinx-err* ]; then
for f in /tmp/sphinx-err*; do
echo $f
cat $f
done
fi
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check that .py files have the license header
run: python3 ci/check-for-license-header.py