-
Notifications
You must be signed in to change notification settings - Fork 68
143 lines (132 loc) · 4.24 KB
/
continuous-integration.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
name: Continuous Integration
on:
push:
branches:
- main
- develop
pull_request:
branches-ignore:
- documentation
workflow_dispatch:
defaults:
run:
# Enable Conda environment by using the login shell:
shell: bash -leo pipefail {0}
jobs:
CI:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-latest, windows-2022]
compiler: [gfortran-12, gfortran-13, gfortran-14]
use-conda-compiler: [false, true]
fpmodel: [DP, SP]
# Most combinations will only be tested on Linux
exclude:
- os: windows-2022
use-conda-compiler: false
# Conda does not contain gfortran-10/11/12 for windows
- os: windows-2022
compiler: gfortran-12
- os: macos-latest
use-conda-compiler: false
env:
FC: ${{ matrix.compiler }}
FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan"
RTE_KERNELS: default
RTE_CBOOL: ON
RRTMGP_DATA_VERSION: v1.8.2
FAILURE_THRESHOLD: 7.e-4
# Debug - works
# Release - works with conda gfortran
# RelWithDebInfo - works
# MinSizeRel - works
BUILD_TYPE: Debug
runs-on: ${{ matrix.os }}
steps:
#
# Relax failure thresholds for single precision
#
- name: Relax failure threshold for single precision
if: matrix.fpmodel == 'SP'
run: echo "FAILURE_THRESHOLD=3.5e-1" >> $GITHUB_ENV
#
# Check out repository under $GITHUB_WORKSPACE
#
- name: Check out code
uses: actions/checkout@v4
#
# Cache Conda packages
#
- name: Cache Conda packages
uses: actions/cache@v4
with:
path: ~/conda_pkgs_dir
key: conda-pkgs-${{ matrix.os }}
#
# Set up Conda
#
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: rte_rrtmgp_test
environment-file: environment-noplots.yml
python-version: 3.11
auto-activate-base: false
# Use the cache properly:
use-only-tar-bz2: false
#
# Install dependencies
#
- name: Install dependencies
run: |
FC_VERSION="${{ env.FC }}"
FC_VERSION="${FC_VERSION##*-}"
echo "FC version: $FC_VERSION"
conda install -c conda-forge netcdf-fortran ninja -y
if ${{ matrix.use-conda-compiler }}; then
conda install -c conda-forge gfortran=$FC_VERSION -y
fi
#
# Build libraries, examples, and tests
#
- name: Build libraries and tests
run: |
AR_PATH="$(which ar)"
RANLIB_PATH="$(which ranlib)"
FC_PATH="$(which gfortran)"
if [[ "${{ matrix.os }}" == "windows-2022" ]]; then
AR_PATH="$AR_PATH.exe"
RANLIB_PATH="$RANLIB_PATH.exe"
FC_PATH="$FC_PATH.exe"
fi
# If not using conda, use the environment's FC variable instead of which gfortran
if ! ${{ matrix.use-conda-compiler }}; then
FC_PATH=${{ env.FC }}
fi
echo "Using AR: $AR_PATH"
echo "Using RANLIB: $RANLIB_PATH"
echo "Using FC: $FC_PATH"
# Run CMake
cmake -S . -B build -G "Ninja" \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_Fortran_COMPILER="$FC_PATH" \
-DCMAKE_Fortran_FLAGS="${{ env.FCFLAGS }}" \
-DCMAKE_AR="$AR_PATH" \
-DCMAKE_RANLIB="$RANLIB_PATH" \
-DRRTMGP_DATA_VERSION=${{ env.RRTMGP_DATA_VERSION }} \
-DPRECISION=${{ matrix.fpmodel }} \
-DUSE_C_BOOL=${{ env.RTE_CBOOL }} \
-DKERNEL_MODE=${{ env.RTE_KERNELS }} \
-DENABLE_TESTS=ON \
-DFAILURE_THRESHOLD=${{ env.FAILURE_THRESHOLD }}
# Build the project
cmake --build build -- -j8
#
# Run examples, tests and checks
#
- name: Run examples, tests and checks
working-directory: build
run: |
ctest -V --output-on-failure