-
Notifications
You must be signed in to change notification settings - Fork 67
154 lines (150 loc) · 4.06 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
144
145
146
147
148
149
150
151
152
153
154
name: Continuous Integration
on:
push:
branches:
- main
- develop
pull_request:
branches-ignore:
- documentation
workflow_dispatch:
jobs:
CI:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
fpmodel: [DP, SP]
toolchain:
- {compiler: gcc, version: 10}
- {compiler: gcc, version: 11}
- {compiler: gcc, version: 12}
include:
- os: ubuntu-latest
shell: bash -leo pipefail {0}
make: make
- os: windows-latest
shell: "msys2 -leo pipefail {0}"
make: mingw32-make.exe
exclude:
- os: windows-latest
toolchain:
compiler: gcc
version: 12
defaults:
run:
shell: ${{ matrix.shell }}
env:
# Core variables:
FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -g -DRTE_USE_CBOOL -DRTE_USE_${{ matrix.fpmodel }}"
# Make variables:
RRTMGP_ROOT: ${{ github.workspace }}
RRTMGP_DATA: ${{ github.workspace }}/rrtmgp-data
RUN_CMD:
FAILURE_THRESHOLD: 7.e-4
steps:
#
# Setup MSYS2 on Windows
#
- if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
path-type: inherit
install: >-
mingw-w64-x86_64-make
mingw-w64-x86_64-netcdf-fortran
#
# Setup Fortran compiler
#
- uses: fortran-lang/[email protected]
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
#
# 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
#
# Check out data
#
- name: Check out data
uses: actions/checkout@v4
with:
repository: earth-system-radiation/rrtmgp-data
path: rrtmgp-data
ref: v1.8.1
#
# Cache Conda packages
#
- name: Cache Conda packages
uses: actions/cache@v4
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ hashFiles('environment-ci.yml') }}
#
# Set up Conda
#
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: rte_rrtmgp_ci
environment-file: environment-ci.yml
auto-activate-base: false
use-mamba: true
# Use the cache properly:
use-only-tar-bz2: true
#
# Install NetCDF-Fortran
#
- name: Install NetCDF-Fortran via Conda
if: runner.os == 'Linux'
run: conda install -y -c conda-forge netcdf-fortran
#
# Setup Linux environment variables
#
- name: Setup env variables - Linux
if: runner.os == 'Linux'
run: |
echo FCINCLUDE=-I ${CONDA_PREFIX}/include >> $GITHUB_ENV
echo LDFLAGS=-L ${CONDA_PREFIX}/lib >> $GITHUB_ENV
echo LD_LIBRARY_PATH=${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH} >> $GITHUB_ENV
#
# Setup Windows environment variables
#
- name: Setup env variables - Windows
if: runner.os == 'Windows'
run: |
echo FCINCLUDE="-I/mingw64/include" >> $GITHUB_ENV
echo LDFLAGS="-L/mingw64/lib" >> $GITHUB_ENV
echo LD_LIBRARY_PATH="/mingw64/lib:/mingw64/bin:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
#
# Build libraries, examples and tests
#
- name: Build libraries
run: |
$FC --version
${{ matrix.make }} -j4 libs
#
# Run examples and tests
#
- name: Build and run examples and tests
run: |
${{ matrix.make }} -j4 tests
#
# Compare the results
#
- name: Compare the results
run: |
${{ matrix.make }} -j4 check