Conda recipe for rte-rrtmgp #1751
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-13, macos-latest, windows-2022] | |
# macos-13 is Intel, macos-latest is ARM/Apple Silicon | |
compiler: [gfortran-12, gfortran-13, gfortran-14] | |
use-conda-compiler: [false, true] | |
fpmodel: [DP, SP] | |
# Most combinations will only be tested on Linux with system compilers | |
exclude: | |
- os: ubuntu-24.04 | |
use-conda-compiler: true | |
- os: windows-2022 | |
# A few configurations are added below | |
- os: macos-13 | |
use-conda-compiler: false | |
- os: macos-13 | |
compiler: gfortran-14 | |
# Not available in conda | |
- os: macos-latest | |
use-conda-compiler: false | |
- os: macos-latest | |
compiler: gfortran-14 | |
# Not available in conda | |
include: | |
# Something like the conda-build environment | |
- os: ubuntu-24.04 | |
compiler: gfortran-13 | |
use-conda-compiler: true | |
- os: windows-2022 | |
compiler: gfortran-13 | |
use-conda-compiler: true | |
fpmodel: DP | |
- os: windows-2022 | |
compiler: gfortran-13 | |
use-conda-compiler: true | |
fpmodel: SP | |
# -12 not available in conda | |
- os: windows-2022 | |
compiler: gfortran-14 | |
use-conda-compiler: true | |
fpmodel: SP | |
# Fails unit tests in double precision! | |
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 |