forked from earth-system-radiation/rte-rrtmgp
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (140 loc) · 4.72 KB
/
continuous-integration.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
name: Continuous Integration
on:
push:
branches-ignore:
- documentation
pull_request:
branches-ignore:
- documentation
jobs:
CI:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
fortran-compiler: [gfortran-9, gfortran-10]
rte-kernels: [default, openacc]
env:
FC: ${{ matrix.fortran-compiler }}
FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -finit-real=nan -g -DRTE_USE_CBOOL"
CC: gcc
NCHOME: /home/runner/netcdf-c
NFHOME: /home/runner/netcdf-fortran
RFMIP_DIR: /home/runner/rfmip-files
steps:
- name: Update system packages
run: sudo apt-get update
############################################################################
#
# Compilers....
#
# Gfortran 10 not available in Github CI stack, so install
#
- name: gfortran-10 setup compiler
if: contains(matrix.fortran-compiler, 'gfortran-10')
run: |
sudo apt-get install gfortran-10 gcc-10
echo "CC=gcc-10" >> $GITHUB_ENV
############################################################################
#
# Netcdf C and Fortran
#
- name: Install HDF5 library
run: |
sudo apt-get install libhdf5-dev libcurl4-gnutls-dev hdf5-helpers
dpkg -L libhdf5-dev
# Skipping this for now - netCDF configure doesn't see the HDF libararies
- name: cache-netcdf-c
id: cache-netcdf-c
uses: actions/cache@v3
with:
path: /home/runner/netcdf-c
key: netcdf-c-4.7.4a-${{ runner.os }}-${{ matrix.fortran-compiler }}
- name: Install netcdf C library from source
if: steps.cache-netcdf-c.outputs.cache-hit != 'true'
env:
CPPFLAGS: -I/usr/include/hdf5/serial
LDFLAGS: -L/usr/lib/x86_64-linux-gnu/hdf5/serial/
run: |
${CC} --version
git clone https://github.com/Unidata/netcdf-c.git --branch v4.7.4
cd netcdf-c
ls /usr/include
./configure --prefix=${NCHOME}
make -j
sudo make install
# Would be great to encode version info
- name: cache-netcdf-fortran
id: cache-netcdf-fortran
uses: actions/cache@v3
with:
path: /home/runner/netcdf-fortran
key: netcdf-fortran-4.5.3-${{ runner.os }}-${{ matrix.fortran-compiler }}
- name: Build NetCDF Fortran library
# Here too it would be nice to use the environment to specify netcdf-c location
env:
CPPFLAGS: -I/home/runner/netcdf-c/include
LDFLAGS: -L/home/runner/netcdf-c/lib
LD_LIBRARY_PATH: /home/runner/netcdf-c/lib
FCFLAGS: -fPIC
if: steps.cache-netcdf-fortran.outputs.cache-hit != 'true'
run: |
echo ${TEST}
${FC} --version
git clone https://github.com/Unidata/netcdf-fortran.git --branch v4.5.3
cd netcdf-fortran
echo ${CPPFLAGS}
./configure --prefix=${NFHOME}
make -j
sudo make install
############################################################################
# Checks out repository under $GITHUB_WORKSPACE
- name: Check out code
uses: actions/checkout@v3
- name: Environmental variables
run: echo "RRTMGP_ROOT=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
- name: Make library, examples, tests
env:
RTE_KERNELS: ${{ matrix.rte-kernels }}
run: |
cd ${RRTMGP_ROOT}
${FC} --version
make libs
make -C build separate-libs
############################################################################
# Set up Python and packages
#
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
activate-environment: rte_rrtmgp_test
environment-file: environment.yml
python-version: 3.9
auto-activate-base: false
############################################################################
- name: Cache RFMIP files
id: cache-rfmip-files
uses: actions/cache@v3
with:
path: /home/runner/rfmip-files # Same as #{RFMIP_DIR}
key: rfmip-files
- name: Stage RFMIP files
if: steps.cache-rfmip-files.outputs.cache-hit != 'true'
run: |
mkdir -p ${RFMIP_DIR}
cd ${RFMIP_DIR}
python ${RRTMGP_ROOT}/examples/rfmip-clear-sky/stage_files.py
############################################################################
# Would be great to encode version info
- name: Run examples, tests
env:
LD_LIBRARY_PATH: /home/runner/netcdf-c/lib
run: |
export LD_LIBRARY_PATH=${NFHOME}/lib:${LD_LIBRARY_PATH}
make tests
- name: Comparison
run: |
make check