-
Notifications
You must be signed in to change notification settings - Fork 7
94 lines (82 loc) · 2.29 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
name: CI
on:
push:
branches: [main, develop]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and test
runs-on: ubuntu-22.04
strategy:
matrix:
compiler: [gfortran-9, gfortran-10, gfortran-11]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libnetcdff-dev
- name: Set up Python (micromamba)
uses: mamba-org/provision-with-micromamba@v15
with:
environment-file: python/environment.yml
cache-env: true
extra-specs: |
python=3.10
- name: Check that default input is nc
run: |
python -c '
import f90nml
with open("input/namelist.canopy") as f:
nml = f90nml.read(f)
assert nml["filenames"]["file_vars"].endswith((".nc", ".ncf")), "nc input by default, like build"
assert nml["userdefs"]["infmt_opt"] == 0, "necessary to read 2-D"
'
- name: Debug compile and run
run: |
make -C src clean
make -C src
./canopy
env:
DEBUG: 1
FC: ${{ matrix.compiler }}
- name: Run Python module as script
run: |
cd python
python canopy_app.py
cd -
- name: Run Python example nbs
run: |
cd python
for f in *.ipynb; do
jupyter nbconvert --to notebook --execute $f
done
cd -
- name: Non-debug compile and run
run: |
make -C src clean
make -C src
./canopy
env:
DEBUG: 0
FC: ${{ matrix.compiler }}
- name: Non-NetCDF compile and run
run: |
make -C src clean
make -C src
f90nml -g filenames -v file_vars="'input/gfs.t12z.20220701.sfcf000.canopy.txt'" \
input/namelist.canopy input/namelist.canopy
f90nml -g userdefs -v infmt_opt=1 \
input/namelist.canopy input/namelist.canopy
./canopy
env:
DEBUG: 0
FC: ${{ matrix.compiler }}
NETCDF: 0