Skip to content

Updating CICD with the new cmake build system #9

Updating CICD with the new cmake build system

Updating CICD with the new cmake build system #9

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:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
fortran-compiler: [gfortran-10, gfortran-11, gfortran-12]
fpmodel: [DP, SP]
env:
# Core variables:
FC: ${{ matrix.fortran-compiler }}
FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -g -DRTE_USE_CBOOL"
# CMake variables:
FCINCLUDE: -I/usr/include
FP_MODEL: ${{ matrix.fpmodel }}
RTE_KERNELS: default
RRTMGP_DATA_VERSION: v1.8.2
RUN_CMD:
FAILURE_THRESHOLD: 7.e-4
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
#
# Check out data
#
# Synchronize the package index
#
- name: Synchronize the package index
run: sudo apt-get update
#
# Install NetCDF-Fortran (compatible with all compilers)
#
- name: Install NetCDF-Fortran
run: sudo apt-get install libnetcdff-dev
#
# Cache Conda packages
#
- name: Cache Conda packages
uses: actions/cache@v4
with:
path: ~/conda_pkgs_dir
key: conda-pkgs
#
# 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: true
#
# Build libraries, examples and tests
#
- name: Build libraries and tests
run: |
$FC --version
cmake -S . -B build \
-DCMAKE_Fortran_COMPILER=$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