-
Notifications
You must be signed in to change notification settings - Fork 14
149 lines (132 loc) · 5.21 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
name: eCLM CI Test
# Controls when the action will run.
on: [push, pull_request]
jobs:
eclm_build_job:
name: ${{ matrix.config.name }}
runs-on: ubuntu-22.04
strategy:
matrix:
config:
- {
name: "eCLM-Standalone",
use_oasis: "False",
coup_oas_icon: "False",
coup_oas_pfl: "False",
use_pdaf: "False"
}
- {
name: "eCLM-ParFlow-ICON",
use_oasis: "True",
coup_oas_icon: "True",
coup_oas_pfl: "True",
use_pdaf: "False"
}
- {
name: "eCLM-PDAF",
use_oasis: "False",
coup_oas_icon: "False",
coup_oas_pfl: "False",
use_pdaf: "True"
}
env:
CC: mpicc
FC: mpifort
BUILD_DIR: bld
INSTALL_DIR: install
OASIS_TAG: tsmp-patches-v0.1
OASIS_INSTALL_PREFIX: ${{ github.workspace }}/oasis3-mct/install
PFUNIT_TAG: v4.10.0
PFUNIT_INSTALL_PREFIX: ${{ github.workspace }}/pFUnit/install
CMAKE_BUILD_PARALLEL_LEVEL: 4
steps:
- uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libxml2-utils pylint wget cmake netcdf-bin libnetcdf-dev libnetcdff-dev libpnetcdf-dev
version: 1.0
execute_install_scripts: true
- name: Download MPI Fortran compiler
run: sudo apt-get install gfortran openmpi-bin libopenmpi-dev
#
# OASIS3-MCT
#
- if: matrix.config.use_oasis == 'True'
name: Restore cached OASIS3-MCT ${{ env.OASIS_TAG }}
uses: actions/cache/restore@v4
id: cache-oasis-restore
with:
path: ${{ env.OASIS_INSTALL_PREFIX }}
key: cache-${{ matrix.config.name }}-${{ env.OASIS_TAG }}
- if: matrix.config.use_oasis == 'True' && steps.cache-oasis-restore.outputs.cache-hit != 'true'
name: Install OASIS3-MCT ${{ env.OASIS_TAG }}
working-directory: ${{ github.workspace }}
run: |
git clone -b $OASIS_TAG https://icg4geo.icg.kfa-juelich.de/ExternalReposPublic/oasis3-mct.git
cd oasis3-mct
export OASIS_ROOT=$(pwd)
cd util/make_dir
echo "include ${GITHUB_WORKSPACE}/.github/build.oasis3-mct.ubuntu22.04" > make.inc
make realclean static-libs -f TopMakefileOasis3
- if: matrix.config.use_oasis == 'True' && steps.cache-oasis-restore.outputs.cache-hit != 'true'
name: Cache OASIS3-MCT ${{ env.OASIS_TAG }}
uses: actions/cache/save@v4
with:
path: ${{ env.OASIS_INSTALL_PREFIX }}
key: cache-${{ matrix.config.name }}-${{ env.OASIS_TAG }}
- if: matrix.config.use_oasis == 'True'
name: Add OASIS to CMAKE_PREFIX_PATH
run: |
echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${OASIS_INSTALL_PREFIX}" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
tree -FUCh --du --filelimit 20 -L 2 ${OASIS_INSTALL_PREFIX}
#
# pFUnit
#
- name: Restore cached pFUnit ${{ env.PFUNIT_TAG }}
uses: actions/cache/restore@v4
id: cache-pFUnit-restore
with:
path: ${{ env.PFUNIT_INSTALL_PREFIX }}
key: cache-${{ matrix.config.name }}-${{ env.PFUNIT_TAG }}
- if: steps.cache-pFUnit-restore.outputs.cache-hit != 'true'
name: Install pFUnit ${{ env.PFUNIT_TAG }}
working-directory: ${{ github.workspace }}
run: |
git clone -b ${PFUNIT_TAG} --recursive https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
cd pFUnit
cmake -S . -B bld -DCMAKE_INSTALL_PREFIX=install
cmake --build bld
cmake --install bld
- if: steps.cache-pFUnit-restore.outputs.cache-hit != 'true'
name: Cache pFUnit ${{ env.PFUNIT_TAG }}
uses: actions/cache/save@v4
with:
path: ${{ env.PFUNIT_INSTALL_PREFIX }}
key: cache-${{ matrix.config.name }}-${{ env.PFUNIT_TAG }}
- name: Add pFUnit to CMAKE_PREFIX_PATH
run: |
echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${PFUNIT_INSTALL_PREFIX}" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
tree -FUCh --du --filelimit 20 -L 2 ${PFUNIT_INSTALL_PREFIX}
#
# eCLM
#
- name: Configure eCLM
run: |
cmake -S src -B $BUILD_DIR \
-DCMAKE_BUILD_TYPE="RELEASE" \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_Fortran_COMPILER=$FC \
-DUSE_OASIS=${{ matrix.config.use_oasis }} \
-DCOUP_OAS_ICON=${{ matrix.config.coup_oas_icon }} \
-DCOUP_OAS_PFL=${{ matrix.config.coup_oas_pfl }} \
-DUSE_PDAF=${{ matrix.config.use_pdaf }} \
-DENABLE_TESTS="True"
- name: Build eCLM
run: cmake --build $BUILD_DIR
- name: Install eCLM
run: cmake --install $BUILD_DIR
- name: Install eCLM namelist generator
run: pip3 install --user ./namelist_generator