-
Notifications
You must be signed in to change notification settings - Fork 49
182 lines (156 loc) · 6.79 KB
/
ci_build_scm_ubuntu_22.04.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: CI test to build the CCPP-SCM on ubuntu v22.04
on: [pull_request,workflow_dispatch]
jobs:
build_scm:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
strategy:
matrix:
fortran-compiler: [gfortran-10, gfortran-11, gfortran-12]
build-type: [Release, Debug]
py-version: [3.7.13, 3.9.12]
# Environmental variables
env:
NFHOME: /home/runner/netcdf-fortran
NFVERSION: v4.5.3
bacio_ROOT: /home/runner/bacio
sp_ROOT: /home/runner/NCEPLIBS-sp
w3emc_ROOT: /home/runner/myw3emc
SCM_ROOT: /home/runner/work/ccpp-scm/ccpp-scm
intel_ROOT: /home/runner/intel
suites: SCM_GFS_v15p2,SCM_GFS_v16,SCM_GFS_v17_p8,SCM_HRRR,SCM_RRFS_v1beta,SCM_RAP,SCM_WoFS_v0,SCM_GFS_v15p2_ps,SCM_GFS_v16_ps,SCM_GFS_v17_p8_ps,SCM_HRRR_ps,SCM_RRFS_v1beta_ps,SCM_RAP_ps,SCM_WoFS_v0_ps
# Workflow steps
steps:
#######################################################################################
# Initial
#######################################################################################
- name: Checkout SCM code (into /home/runner/work/ccpp-scm/)
uses: actions/checkout@v3
- name: Initialize submodules
run: git submodule update --init --recursive
#######################################################################################
# Python setup
#######################################################################################
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{matrix.py-version}}
- name: Add conda to system path
run: |
echo $CONDA/bin >> $GITHUB_PATH
- name: Install NetCDF Python libraries
run: |
conda install --yes -c conda-forge h5py>=3.4 netCDF4 f90nml
- name: Update system packages
run: sudo apt-get update
#######################################################################################
# Install FORTRAN dependencies
#######################################################################################
- name: Environment for ifort compiler
if: contains(matrix.fortran-compiler, 'ifort')
run: |
echo "CC=icx" >> $GITHUB_ENV
echo "FC=ifort" >> $GITHUB_ENV
echo "NFVERSION=v4.4.4" >> $GITHUB_ENV
- name: Cache Intel compilers
id: cache-intel-compilers
if: contains(matrix.fortran-compiler, 'ifort')
uses: actions/cache@v2
with:
path: /home/runner/intel
key: intel-${{ runner.os }}-compilers-b
# https://software.intel.com/content/www/us/en/develop/articles/installing-intel-oneapi-toolkits-via-apt.html
# List of packages from Docker file at
# https://github.com/intel/oneapi-containers/blob/master/images/docker/hpckit-devel-ubuntu18.04/Dockerfile
- name: Install Intel compilers and libraries
if: contains(matrix.fortran-compiler, 'ifort') && steps.cache-intel-compilers.outputs.cache-hit != 'true'
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
sudo apt-get update
sudo apt-get install intel-hpckit-getting-started intel-oneapi-clck intel-oneapi-common-licensing intel-oneapi-common-vars
sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-compiler-fortran intel-oneapi-itac
- name: Cache bacio library v2.4.1
id: cache-bacio-fortran
uses: actions/cache@v3
with:
path: /home/runner/bacio
key: cache-bacio-fortran-${{matrix.fortran-compiler}}-key
- name: Install bacio library v2.4.1
if: steps.cache-bacio-fortran.outputs.cache-hit != 'true'
run: |
git clone --branch v2.4.1 https://github.com/NOAA-EMC/NCEPLIBS-bacio.git bacio
cd bacio && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${bacio_ROOT} ../
make -j2
make install
echo "bacio_DIR=/home/runner/bacio/lib/cmake/bacio" >> $GITHUB_ENV
- name: Cache SP-library v2.3.3
id: cache-sp-fortran
uses: actions/cache@v3
with:
path: /home/runner/NCEPLIBS-sp
key: cache-sp-fortran-${{matrix.fortran-compiler}}-key
- name: Install SP-library v2.3.3
if: steps.cache-sp-fortran.outputs.cache-hit != 'true'
run: |
git clone --branch v2.3.3 https://github.com/NOAA-EMC/NCEPLIBS-sp.git NCEPLIBS-sp
cd NCEPLIBS-sp && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${sp_ROOT} ../
make -j2
make install
echo "sp_DIR=/home/runner/NCEPLIBS-sp/lib/cmake/sp" >> $GITHUB_ENV
- name: Cache w3emc library v2.9.2
id: cache-w3emc-fortran
uses: actions/cache@v3
with:
path: /home/runner/myw3emc
key: cache-w3emc-fortran-${{matrix.fortran-compiler}}-key
- name: Install w3emc library v2.9.2
if: steps.cache-w3emc-fortran.outputs.cache-hit != 'true'
run: |
git clone --branch v2.9.2 https://github.com/NOAA-EMC/NCEPLIBS-w3emc.git NCEPLIBS-w3emc
cd NCEPLIBS-w3emc && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${w3emc_ROOT} ../
make -j2
make install
echo "w3emc_DIR=/home/runner/myw3emc/lib/cmake/w3emc" >> $GITHUB_ENV
- name: Install NetCDF C library
run: |
sudo apt-get update
sudo apt-get install libnetcdf-dev
- name: Cache NetCDF Fortran library
id: cache-netcdf-fortran
uses: actions/cache@v3
with:
path: /home/runner/netcdf-fortran
key: cache-netcdf-fortran-${{matrix.fortran-compiler}}-key
- name: Install NetCDF Fortran library
if: steps.cache-netcdf-fortran.outputs.cache-hit != 'true'
run: |
git clone --branch ${NFVERSION} https://github.com/Unidata/netcdf-fortran.git
cd netcdf-fortran
./configure
make -j
sudo make install
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NFHOME}/lib
#######################################################################################
# Build SCM.
#######################################################################################
- name: Configure build with CMake (Release)
if: contains(matrix.build-type, 'Release')
run: |
cd ${SCM_ROOT}/scm
mkdir bin && cd bin
cmake -DCCPP_SUITES=${suites} ../src
- name: Configure build with CMake (Debug)
if: contains(matrix.build-type, 'Debug')
run: |
cd ${SCM_ROOT}/scm
mkdir bin && cd bin
cmake -DCCPP_SUITES=${suites} -DCMAKE_BUILD_TYPE=Debug ../src
- name: Build SCM
run: |
cd ${SCM_ROOT}/scm/bin
make -j4