-
Notifications
You must be signed in to change notification settings - Fork 158
160 lines (138 loc) · 5.59 KB
/
GCC.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
# This is a CI workflow for the fv3atm project.
#
# This workflow builds and tests the fv3atm library using GCC, and it tests
# different CMake build options.
#
# Alex Richert, 6 Dec 2023
name: GCC
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
build_spack:
runs-on: ubuntu-latest
strategy:
matrix:
gcc_ver: ["12"]
mpi: ["mpich", "openmpi"]
steps:
- name: checkout-fv3atm
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/fv3atm
submodules: recursive
- name: install-cmake
run: |
cd ${{ github.workspace }}
curl -f -s -S -R -L https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-Linux-x86_64.tar.gz | tar -zx
echo "${{ github.workspace }}/cmake-3.29.2-linux-x86_64/bin" >> $GITHUB_PATH
- name: cache-spack
id: cache-spack
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/spack-develop
key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }}
# Building dependencies takes 40+ min
- name: spack-install
if: steps.cache-spack.outputs.cache-hit != 'true'
run: |
wget --no-verbose https://github.com/spack/spack/archive/refs/heads/develop.zip
unzip develop.zip -d ${GITHUB_WORKSPACE}/ &> unzip.out
. ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh
spack env create gcc${{ matrix.gcc_ver }} ${GITHUB_WORKSPACE}/fv3atm/ci/spack.yaml
spack env activate gcc${{ matrix.gcc_ver }}
spack compiler find | grep gcc@${{ matrix.gcc_ver }}
spack external find gmake cmake git git-lfs perl python ${{ matrix.mpi }}
spack config add "packages:all:require:['%gcc@${{ matrix.gcc_ver }}']"
spack config add "packages:mpi:require:'${{ matrix.mpi }}'"
spack concretize |& tee ${SPACK_ENV}/log.concretize
spack install -j2 --fail-fast
echo "spackrc=$?" >> ${GITHUB_ENV}
spack clean --all
build_fv3atm:
needs: build_spack
runs-on: ubuntu-latest
strategy:
matrix:
cmake_opts: ["-D32BIT=ON", "-D32BIT=OFF"]
gcc_ver: ["12"]
mpi: ["mpich", "openmpi"]
steps:
# Only do Doxygen and gcovr build for one job
- name: decide-doc-gcovr-build
run: |
if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 12 && "${{ matrix.mpi }}" == mpich ]]; then
echo 'devbuild=ON' | tee -a ${GITHUB_ENV}
echo 'gcov_cmake="-DCMAKE_Fortran_FLAGS=-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0"' | tee -a ${GITHUB_ENV}
else
echo 'devbuild=OFF' | tee -a ${GITHUB_ENV}
fi
- name: install-utilities
run: |
sudo apt-get install doxygen graphviz
python3 -m pip install gcovr
- name: install-cmake
run: |
cd ${{ github.workspace }}
curl -f -s -S -R -L https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-Linux-x86_64.tar.gz | tar -zx
echo "${{ github.workspace }}/cmake-3.29.2-linux-x86_64/bin" >> $GITHUB_PATH
- name: checkout-fv3atm
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/fv3atm
submodules: recursive
- name: cache-spack
id: cache-spack
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/spack-develop
key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }}
- name: build-fv3atm
run: |
. ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh
spack env activate gcc${{ matrix.gcc_ver }}
spack load $(spack find --format "{name}")
cd ${GITHUB_WORKSPACE}/fv3atm
git clone https://github.com/NOAA-EMC/CMakeModules
git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics stochastic_physics_repo
mkdir ${GITHUB_WORKSPACE}/build
cd ${GITHUB_WORKSPACE}/build
export CC=mpicc
export CXX=mpicxx
export FC=mpif90
cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON ${{ env.gcov_cmake }}
make -j2
- name: run-tests
run: |
cd $GITHUB_WORKSPACE/build
ctest -j2 --output-on-failure --rerun-failed
- name: get-test-coverage
if: ${{ env.devbuild == 'ON' }}
run: |
cd $GITHUB_WORKSPACE/build
gcovr -r .. -v --html-details --gcov-executable gcov-12 --exclude $GITHUB_WORKSPACE/fv3atm/tests --exclude $GITHUB_WORKSPACE/fv3atm/stochastic_physics_repo --exclude $GITHUB_WORKSPACE/fv3atm/build/ccpp --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/physics --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/framework --exclude $GITHUB_WORKSPACE/fv3atm/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html
- name: upload-test-coverage
uses: actions/upload-artifact@v4
if: ${{ env.devbuild == 'ON' }}
with:
name: test-coverage-fv3atm-${{ github.sha }}
path: |
${{ github.workspace }}/build/*.html
${{ github.workspace }}/build/*.css
- name: upload-docs
uses: actions/upload-artifact@v4
if: ${{ env.devbuild == 'ON' }}
with:
name: docs-fv3atm
path: |
build/docs/html
- name: debug-artifacts
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ccpp_prebuild_logs-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }}-${{ matrix.cmake_opts }}
path: ${{ github.workspace }}/build/ccpp/ccpp_prebuild.*