-
Notifications
You must be signed in to change notification settings - Fork 21
86 lines (73 loc) · 2.16 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
name: CI
on:
push:
branches: [stable, develop]
pull_request:
branches: [stable, develop]
workflow_dispatch:
schedule:
- cron: "0 12 * * 1"
jobs:
test:
name: Test
runs-on: ubuntu-latest
if: github.repository == 'noaa-oar-arl/monet'
strategy:
matrix:
python-version: ["3.6", "3.8", "3.10"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up Python (micromamba)
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment-dev.yml
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
- name: Downgrades if on Python 3.6
if: matrix.python-version == '3.6'
run: micromamba install cf_xarray=0.6.3 attrs=22.2.0
- name: Ensure xesmf>=0.7 if not on Python 3.6
if: matrix.python-version != '3.6'
run: |
update_needed=$(python -c "
import sys
from packaging.version import Version
try:
import xesmf as xe
except ImportError as e:
print(e, file=sys.stderr)
print('y')
raise SystemExit()
v = Version(getattr(xe, '__version__', '0.0.0'))
print(v, file=sys.stderr)
print('n' if v >= Version('0.7') else 'y')
")
if [[ $update_needed == 'y' ]]; then
micromamba install 'xesmf>=0.7'
fi
- name: Install package
run: python -m pip install -e . --no-deps
- name: Test with pytest
run: pytest -v
docs:
name: Check docs build
runs-on: ubuntu-latest
if: github.repository == 'noaa-oar-arl/monet'
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up Python (micromamba)
uses: mamba-org/setup-micromamba@v2
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