Skip to content

Continuous Integration #49

Continuous Integration

Continuous Integration #49

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-22.04, macos-13, windows-2022]
toolchain:
- {compiler: gcc, version: 10}
- {compiler: gcc, version: 11}
- {compiler: gcc, version: 12}
fpmodel: [DP, SP]
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"
FP_MODEL: ${{ matrix.fpmodel }}
RTE_KERNELS: default
RRTMGP_DATA_VERSION: v1.8.2
FAILURE_THRESHOLD: 7.e-4
runs-on: ${{ matrix.os }}
steps:
#
# Set up Fortran compilers
#
- uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
- name: Add gfortran to PATH
run: |
# Locate gfortran (example assumes MinGW installation)
GFORTRAN_PATH=$(dirname "$(which gfortran)")
echo "Adding gfortran path: $GFORTRAN_PATH"
echo "$GFORTRAN_PATH" >> $GITHUB_PATH
gfortran --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
#
# 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 (OS-specific)
#
- name: Install dependencies
run: |
conda install -c conda-forge netcdf-fortran -y
#
# Build libraries, examples, and tests
#
- name: Build libraries and tests
run: |
echo "${{ env.FC }}" >> $GITHUB_PATH
cmake -S . -B build \
-DCMAKE_Fortran_COMPILER="${{ env.FC }}" \
-DCMAKE_Fortran_FLAGS="$FCFLAGS" \
-DRRTMGP_DATA_VERSION=$RRTMGP_DATA_VERSION \
-DFP_MODEL=$FP_MODEL \
-DRTE_KERNEL_MODE=$RTE_KERNELS \
-DENABLE_TESTS=ON \
-DFAILURE_THRESHOLD=$FAILURE_THRESHOLD
cmake --build build --config Release -- -j8
#
# Run examples, tests and checks
#
- name: Run examples, tests and checks
run: |
ctest -V --test-dir build