Skip to content

Bump actions/upload-artifact from 4.4.0 to 4.4.1 #124

Bump actions/upload-artifact from 4.4.0 to 4.4.1

Bump actions/upload-artifact from 4.4.0 to 4.4.1 #124

name: Continuous integration in containers
on: [push, pull_request, workflow_dispatch]
jobs:
Containerized-CI:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
compiler: [ifort, ifx]
include:
# Flags and KGOs for Intel Fortran Compiler Classic
- compiler: ifort
fcflags: -m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08
gdkgo1: https://docs.google.com/uc?export=download&id=1dva4lq4ZXciTiuOvGgA8OUJKihbGQ90K
gdkgo2: https://docs.google.com/uc?export=download&id=1ns0OtWU5jVnu1IEBfBN-tlTkq2PTrcvC
# Flags and KGOs for Intel Fortran Compiler
- compiler: ifx
fcflags: -debug -traceback -O0 -heap-arrays -assume realloc_lhs -extend-source 132 -stand f08
gdkgo1: https://docs.google.com/uc?export=download&id=1WzFsoqi0EZfsyyh203QXmUQTIh5tBm9b
gdkgo2: https://docs.google.com/uc?export=download&id=1ezYqG-jfZ6i9bRgKOWUyBiQlMhtncpKj
# Set container images
- compiler: ifort
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:oneapi
- compiler: ifx
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:oneapi
# Common variables
- kgo_version: v004
defaults:
run:
shell: bash -el {0}
container:
image: ${{ matrix.image }}
env:
F90: ${{ matrix.compiler }}
FC: ${{ matrix.compiler }}
F90FLAGS: ${{ matrix.fcflags }}
# Make variables:
NFHOME: /opt/netcdf-fortran
# KGO tests variables
ATOL: 0.0
RTOL: 0.0
KGO_VERSION: ${{ matrix.kgo_version }}
GDKGO1: ${{ matrix.gdkgo1 }}
GDKGO2: ${{ matrix.gdkgo2 }}
steps:
#
# Checks-out repository under $GITHUB_WORKSPACE
#
- uses: actions/checkout@v4
# Set up conda environment
- name: Setup conda environment
uses: conda-incubator/[email protected]
with:
auto-update-conda: true
activate-environment: ci-env
environment-file: build/environment.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false
###############################################################################
# Build COSP and retrieve input and test files
###############################################################################
# Build COSP2 driver. Intel Fortran stores automatic arrays in the stack
# by default, whereas GNU Fortran stores them in the heap. This can cause
# segmentation faults with ifort, especially in memory-intensive applications
# like COSP. We tell ifort to use heap arrays.
- name: Build driver
run: |
${F90} --version
cd build
make -j driver
# Retrieve and expand large data files
- name: Retrieve input files
run: |
GDFILE='https://docs.google.com/uc?export=download&id=17eK4_DVEvFOE9Uf6siXJDpWZJKT1aqkU'
OUTPATH=driver/data/inputs/UKMO/cosp_input.um_global.nc.gz
curl -sSfL -o $OUTPATH $GDFILE
gunzip ${OUTPATH}
cd driver/data/inputs/UKMO
md5sum -c cosp_input.um_global.nc.md5
- name: Retrieve KGOs for basic test
run: |
cd ${GITHUB_WORKSPACE}
OUTPATH=driver/data/outputs/UKMO/cosp2_output_um.$F90.kgo.$KGO_VERSION.nc.gz
curl -sSfL -o $OUTPATH $GDKGO1
gunzip ${OUTPATH}
cd driver/data/outputs/UKMO
# md5sum -c cosp2_output_um.${F90}.kgo.$KGO_VERSION.nc.md5
- name: Retrieve KGOs for global test
run: |
cd ${GITHUB_WORKSPACE}
OUTPATH=driver/data/outputs/UKMO/cosp2_output.um_global.${F90}.kgo.$KGO_VERSION.nc.gz
curl -sSfL -o $OUTPATH $GDKGO2
gunzip ${OUTPATH}
cd driver/data/outputs/UKMO
# md5sum -c cosp2_output.um_global.${F90}.kgo.$KGO_VERSION.nc.md5
###############################################################################
# Run COSP2 tests. Basic test and UM global snapshot
###############################################################################
- name: Basic test and UM global snapshot
run: |
cd driver/run
./cosp2_test cosp2_input_nl.txt
./cosp2_test cosp2_input_nl.um_global.txt
###############################################################################
# Compare results against known good outputs. As above,
# we split it in as many steps as tests.
###############################################################################
# 1. Basic test
- name: Basic against known good output (KGO)
run: |
cd driver
KGO=data/outputs/UKMO/cosp2_output_um.${{ matrix.compiler }}.kgo.$KGO_VERSION.nc
TST=data/outputs/UKMO/cosp2_output_um.nc
STATS=data/outputs/UKMO/cosp2_output_um.${{ matrix.compiler }}.out
python compare_to_kgo.py ${KGO} ${TST} --atol=${ATOL} --rtol=${RTOL} --stats_file=${STATS}
# 2. UM global snapshot.
- name: UM global against known good output (KGO)
run: |
cd driver
KGO=data/outputs/UKMO/cosp2_output.um_global.${{ matrix.compiler }}.kgo.$KGO_VERSION.nc
TST=data/outputs/UKMO/cosp2_output.um_global.nc
STATS=data/outputs/UKMO/cosp2_output.um_global.${{ matrix.compiler }}.out
python compare_to_kgo.py ${KGO} ${TST} --atol=${ATOL} --rtol=${RTOL} --stats_file=${STATS}
###############################################################################
# Produce plots when it fails during global snapshot tests,
# and create a tarball with outputs.
###############################################################################
- name: Produce plots and create tarball
if: failure()
run: |
cd driver
if [[ -e data/outputs/UKMO/cosp2_output.um_global.nc ]]; then
python plot_test_outputs.py
fi
cd data/outputs/UKMO
tar --ignore-failed-read -czf outputs.${{ matrix.compiler }}.UKMO.tgz cosp2_output.um_global.nc \
cosp2_output_um.nc *.png cosp2_output*.${{ matrix.compiler }}.out
ls -lh
###############################################################################
# Make output files available if any test fails
###############################################################################
- name: Upload output file if test fails
if: failure()
uses: actions/[email protected]
with:
name: outputs.${{ matrix.compiler }}.UKMO.tgz
path: driver/data/outputs/UKMO/outputs.${{ matrix.compiler }}.UKMO.tgz