-
Notifications
You must be signed in to change notification settings - Fork 35
183 lines (157 loc) · 5.69 KB
/
build.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
183
name: build
# Controls when the action will run
on:
# Trigger the workflow on all pushes, except on tag creation
push:
branches:
- '**'
tags-ignore:
- '**'
# Trigger the workflow on all pull requests
pull_request: ~
# Allow workflow to be dispatched on demand
workflow_dispatch: ~
env:
ECRAD_TOOLS: ${{ github.workspace }}/.github/tools
CTEST_PARALLEL_LEVEL: 1
CACHE_SUFFIX: v1 # Increase to force new cache to be created
jobs:
ci:
name: ci
strategy:
fail-fast: false # false: try to complete all jobs
matrix:
build_type: [Release,Bit,Debug]
name:
- linux gnu-12
- linux nvhpc-24.3
# - linux intel-classic
include:
- name: linux gnu-12
os: ubuntu-22.04
compiler: gnu-12
compiler_cc: gcc-12
compiler_cxx: g++-12
compiler_fc: gfortran-12
ctest_options: -E memory
caching: true
- name: linux nvhpc-24.3
os: ubuntu-22.04
compiler: nvhpc-24.3
compiler_cc: nvc
compiler_cxx: nvc++
compiler_fc: nvfortran
ctest_options: -E memory
caching: true
# caching: false
# Intel compiler segfaults in CI with unclear pthread-related backtrace
# - name : linux intel-classic
# os: ubuntu-20.04
# compiler: intel-classic
# compiler_cc: icc
# compiler_cxx: icpc
# compiler_fc: ifort
# caching: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Environment
run: |
echo "DEPS_DIR=${{ runner.temp }}/deps" >> $GITHUB_ENV
echo "CC=${{ matrix.compiler_cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.compiler_cxx }}" >> $GITHUB_ENV
echo "FC=${{ matrix.compiler_fc }}" >> $GITHUB_ENV
if [[ "${{ matrix.os }}" =~ macos ]]; then
brew install ninja
else
sudo apt-get update
sudo apt-get install ninja-build libcurl4-openssl-dev
fi
printenv
- name: Cache Dependencies
# There seems to be a problem with cached NVHPC dependencies, leading to SIGILL perhaps due to slightly different architectures
if: matrix.caching
id: deps-cache
# uses: pat-s/always-upload-cache@v2.1.5
uses: actions/cache@v4
with:
path: ${{ env.DEPS_DIR }}
key: deps-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ env.CACHE_SUFFIX }}
save-always: true
# Free up disk space for nvhpc
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
if: contains( matrix.compiler, 'nvhpc' )
continue-on-error: true
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Install NVHPC compiler
if: contains( matrix.compiler, 'nvhpc' )
shell: bash -eux {0}
run: |
${ECRAD_TOOLS}/install-nvhpc.sh --prefix /opt/nvhpc --version 24.3
source /opt/nvhpc/env.sh
echo "${NVHPC_DIR}/compilers/bin" >> $GITHUB_PATH
echo "NVHPC_ROOT=${NVHPC_DIR}" >> $GITHUB_ENV
- name: Install Intel oneAPI compiler
if: contains( matrix.compiler, 'intel' )
run: |
${ECRAD_TOOLS}/install-intel-oneapi.sh
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
echo "CACHE_SUFFIX=$CC-$($CC -dumpversion)" >> $GITHUB_ENV
- name: Install HDF5
run: |
if [[ -f ${{ env.DEPS_DIR }}/hdf5/lib/libhdf5.settings ]]; then
echo "::debug::HDF5 restored from cache"
else
${ECRAD_TOOLS}/install-hdf5.sh --prefix ${{ env.DEPS_DIR }}/hdf5
fi
echo "HDF5_ROOT=${{ env.DEPS_DIR }}/hdf5" >> $GITHUB_ENV
- name: Install NetCDF C
run: |
if [[ -f ${{ env.DEPS_DIR }}/netcdf/bin/nc-config ]]; then
echo "::debug::NetCDF C restored from cache"
else
${ECRAD_TOOLS}/install-netcdf-c.sh --prefix ${{ env.DEPS_DIR }}/netcdf --hdf5-root ${HDF5_ROOT}
fi
echo "NETCDF_ROOT=${{ env.DEPS_DIR }}/netcdf" >> $GITHUB_ENV
- name: Install NetCDF Fortran
run: |
if [[ -f ${NETCDF_ROOT}/bin/nf-config ]]; then
echo "::debug::NetCDF Fortran restored from cache"
else
${ECRAD_TOOLS}/install-netcdf-fortran.sh --prefix ${{ env.DEPS_DIR }}/netcdf --netcdf-root ${NETCDF_ROOT}
fi
- name: Build & Test
id: build-test
uses: ecmwf-actions/build-package@v2
with:
self_coverage: false
force_build: true
cache_suffix: "${{ matrix.build_type }}-${{ env.CACHE_SUFFIX }}"
recreate_cache: ${{ matrix.caching == false }}
dependencies: |
ecmwf/ecbuild
ecmwf-ifs/fiat
dependency_branch: develop
dependency_cmake_options: |
ecmwf-ifs/fiat: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_TESTS=OFF"
cmake_options: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.cmake_options }} -DENABLE_SINGLE_PRECISION=ON"
ctest_options: "${{ matrix.ctest_options }}"
# - name: Codecov Upload
# if: steps.build-test.outputs.coverage_file
# uses: codecov/codecov-action@v2
# with:
# files: ${{ steps.build-test.outputs.coverage_file }}