forked from NOAA-EMC/WW3
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (96 loc) · 3.41 KB
/
gnu.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
name: GNU Linux Build
on: [push, pull_request, workflow_dispatch]
# Cancel in-progress workflows when pushing to a branch
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
cache_key: gnu11
CC: gcc-10
FC: gfortran-10
CXX: g++-10
# Split into a steup step, and a WW3 build step which
# builds multiple switches in a matrix. The setup is run once and
# the environment is cached so each build of WW3 can share the dependencies.
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: checkout-ww3
if: steps.cache-env.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
path: ww3
# Cache spack, OASIS, and compiler
# No way to flush Action cache, so key may have # appended
- name: cache-env
id: cache-env
uses: actions/cache@v3
with:
path: |
spack
~/.spack
work_oasis3-mct
key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack_gnu.yaml') }}
# Build WW3 spack environment
- name: install-dependencies-with-spack
if: steps.cache-env.outputs.cache-hit != 'true'
run: |
# Install NetCDF, ESMF, g2, etc using Spack
sudo apt install cmake
git clone -c feature.manyFiles=true https://github.com/JCSDA/spack.git
source spack/share/spack/setup-env.sh
spack env create ww3-gnu ww3/model/ci/spack_gnu.yaml
spack env activate ww3-gnu
spack compiler find
spack external find cmake
spack add [email protected]
spack concretize
spack install --dirty -v
- name: build-oasis
if: steps.cache-env.outputs.cache-hit != 'true'
run: |
source spack/share/spack/setup-env.sh
spack env activate ww3-gnu
export WWATCH3_DIR=${GITHUB_WORKSPACE}/ww3/model
export OASIS_INPUT_PATH=${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/oasis3-mct
export OASIS_WORK_PATH=${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/work_oasis3-mct
cd ww3/regtests/ww3_tp2.14/input/oasis3-mct/util/make_dir
cmake .
make VERBOSE=1
cp -r ${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/work_oasis3-mct ${GITHUB_WORKSPACE}
build:
needs: setup
strategy:
matrix:
switch: [Ifremer1, NCEP_st2, NCEP_st4, ite_pdlib, NCEP_st4sbs, NCEP_glwu, OASACM, UKMO, MULTI_ESMF]
runs-on: ubuntu-latest
steps:
- name: checkout-ww3
uses: actions/checkout@v3
with:
path: ww3
- name: cache-env
id: cache-env
uses: actions/cache@v3
with:
path: |
spack
~/.spack
work_oasis3-mct
key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack_gnu.yaml') }}
- name: build-ww3
run: |
source spack/share/spack/setup-env.sh
spack env activate ww3-gnu
cd ww3
export CC=mpicc
export FC=mpif90
export OASISDIR=${GITHUB_WORKSPACE}/work_oasis3-mct
mkdir build && cd build
if [[ ${{ matrix.switch }} == "MULTI_ESMF" ]]; then
cmake .. -DMULTI_ESMF=ON -DSWITCH=multi_esmf
else
cmake .. -DSWITCH=${{ matrix.switch }}
fi
make -j2 VERBOSE=1