Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 31 additions & 49 deletions .github/workflows/mpas_dynamical_core_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- synchronize
push:
branches:
- 'staging/**'
- staging/**
- development
workflow_dispatch:

Expand All @@ -28,12 +28,12 @@ jobs:
conditional-check:
name: Check if jobs should run
timeout-minutes: 1
runs-on: ubuntu-24.04
runs-on: ubuntu-slim
outputs:
should-run: ${{ steps.conditional.outputs.result }}
steps:
- name: Checkout CAM-SIMA
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Check if there are changes to MPAS dynamical core
id: conditional
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
overall-status:
name: Overall status
timeout-minutes: 1
runs-on: ubuntu-24.04
runs-on: ubuntu-slim
needs:
- conditional-check
- source-code-linting
Expand Down Expand Up @@ -196,21 +196,21 @@ jobs:
source-code-linting:
name: Lint Fortran source code
timeout-minutes: 10
runs-on: ubuntu-24.04
runs-on: ubuntu-slim
needs: conditional-check
if: ${{ needs.conditional-check.outputs.should-run == 'true' }}
env:
FORTITUDE_VERSION: '0.7.*'
FORTITUDE_VERSION: 0.7.*
SOURCE_CODE_PATH: ${{ github.workspace }}/src/dynamics/mpas
steps:
- name: Checkout CAM-SIMA
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup Python
uses: actions/setup-python@v6
with:
cache: pip
python-version: '3.12'
python-version: 3.12

- name: Install Fortitude
run: |
Expand All @@ -226,77 +226,59 @@ jobs:

- name: Upload Fortran source code linting log
if: ${{ always() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
if-no-files-found: ignore
name: source-code-linting-log
path: ${{ env.SOURCE_CODE_PATH }}/source-code-linting.log
retention-days: 7
unit-tests:
name: Build and run unit tests (GCC ${{ matrix.gcc-version }})
name: Build and run unit tests (${{ matrix.compiler }})
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
gcc-version:
- '12'
- '13'
- '14'
compiler:
- gnu-11
- gnu-12
- gnu-13
- gnu-14
- gnu-15
- intel-2024
- intel-2025
# The unit tests in MPAS dynamical core currently do not involve any MPI functionalities.
# Testing with a single MPI implementation is sufficient for now.
mpi:
- open-mpi-5
runs-on: ubuntu-24.04
container:
image: ghcr.io/kuanchihwang/atm-sci-container:2026-04-12_${{ matrix.compiler }}_${{ matrix.mpi }}
needs: conditional-check
if: ${{ needs.conditional-check.outputs.should-run == 'true' }}
env:
CC: gcc-${{ matrix.gcc-version }}
CXX: g++-${{ matrix.gcc-version }}
FC: gfortran-${{ matrix.gcc-version }}
PFUNIT_BUILD_TYPE: Release
PFUNIT_PATH: ${{ github.workspace }}/pFUnit
PFUNIT_REFERENCE: 'v4.13.0'
CONTAINER_ENVIRONMENT: pfunit
UNIT_TESTS_BUILD_TYPE: Debug
UNIT_TESTS_PATH: ${{ github.workspace }}/src/dynamics/mpas
steps:
- name: Checkout CAM-SIMA
uses: actions/checkout@v5

# pFUnit takes a while to build. Cache it if possible to save time on consecutive workflow runs.
- name: Cache pFUnit
id: cache-pfunit
uses: actions/cache@v4
with:
key: cache-pfunit-${{ env.PFUNIT_REFERENCE }}-gcc-v${{ matrix.gcc-version }}-mpas
path: ${{ env.PFUNIT_PATH }}/install

# If there is a cache hit, just use the cached pFUnit and skip this step.
- name: Checkout pFUnit
if: ${{ steps.cache-pfunit.outputs.cache-hit != 'true' }}
uses: actions/checkout@v5
with:
repository: Goddard-Fortran-Ecosystem/pFUnit
ref: ${{ env.PFUNIT_REFERENCE }}
path: pFUnit

# If there is a cache hit, just use the cached pFUnit and skip this step.
- name: Build pFUnit
if: ${{ steps.cache-pfunit.outputs.cache-hit != 'true' }}
run: |
cmake -D CMAKE_BUILD_TYPE="$PFUNIT_BUILD_TYPE" -D CMAKE_INSTALL_PREFIX="$PFUNIT_PATH/install" -B "$PFUNIT_PATH/build" -S "$PFUNIT_PATH"
cmake --build "$PFUNIT_PATH/build" --config "$PFUNIT_BUILD_TYPE"
cmake --install "$PFUNIT_PATH/build" --config "$PFUNIT_BUILD_TYPE" --prefix "$PFUNIT_PATH/install"
uses: actions/checkout@v6

- name: Build unit tests
run: |
cmake -D CMAKE_BUILD_TYPE="$UNIT_TESTS_BUILD_TYPE" -D CMAKE_PREFIX_PATH="$PFUNIT_PATH/install" -B "$UNIT_TESTS_PATH/build" -S "$UNIT_TESTS_PATH"
source "$(command -v container-entrypoint-hook.sh)"
cmake -D CMAKE_BUILD_TYPE="$UNIT_TESTS_BUILD_TYPE" -B "$UNIT_TESTS_PATH/build" -S "$UNIT_TESTS_PATH"
cmake --build "$UNIT_TESTS_PATH/build" --config "$UNIT_TESTS_BUILD_TYPE"

- name: Run unit tests
run: |
source "$(command -v container-entrypoint-hook.sh)"
ctest --build-config "$UNIT_TESTS_BUILD_TYPE" --output-log "$UNIT_TESTS_PATH/build/unit-tests.log" --output-on-failure --test-dir "$UNIT_TESTS_PATH/build" --verbose

- name: Upload unit tests log
if: ${{ always() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
if-no-files-found: ignore
name: unit-tests-log-gcc-v${{ matrix.gcc-version }}
name: unit-tests-log-${{ matrix.compiler }}
path: ${{ env.UNIT_TESTS_PATH }}/build/unit-tests.log
retention-days: 7
8 changes: 4 additions & 4 deletions src/dynamics/mpas/tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ add_pfunit_ctest(test_dyn_mpas_procedures
target_compile_options(test_dyn_mpas_procedures
PRIVATE
$<$<AND:$<CONFIG:Debug>,$<Fortran_COMPILER_ID:GNU>>:-fbacktrace -fcheck=all -ffpe-trap=invalid,overflow,zero -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -std=f2018 -Wall -Wextra -Wpedantic>
$<$<AND:$<CONFIG:Debug>,$<Fortran_COMPILER_ID:Intel>>:-check all -fp-model=precise -stand f18 -traceback -warn all>
$<$<AND:$<CONFIG:Debug>,$<Fortran_COMPILER_ID:IntelLLVM>>:-check all -fp-model=precise -stand f18 -traceback -warn all>
$<$<AND:$<CONFIG:Debug>,$<Fortran_COMPILER_ID:Intel>>:-check all -fp-model=precise -stand f18 -traceback -warn all,nointerfaces>
$<$<AND:$<CONFIG:Debug>,$<Fortran_COMPILER_ID:IntelLLVM>>:-check all -fp-model=precise -stand f18 -traceback -warn all,nointerfaces>
)

add_pfunit_ctest(test_dyn_procedures
Expand All @@ -22,6 +22,6 @@ add_pfunit_ctest(test_dyn_procedures
target_compile_options(test_dyn_procedures
PRIVATE
$<$<AND:$<CONFIG:Debug>,$<Fortran_COMPILER_ID:GNU>>:-fbacktrace -fcheck=all -ffpe-trap=invalid,overflow,zero -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -std=f2018 -Wall -Wextra -Wpedantic>
$<$<AND:$<CONFIG:Debug>,$<Fortran_COMPILER_ID:Intel>>:-check all -fp-model=precise -stand f18 -traceback -warn all>
$<$<AND:$<CONFIG:Debug>,$<Fortran_COMPILER_ID:IntelLLVM>>:-check all -fp-model=precise -stand f18 -traceback -warn all>
$<$<AND:$<CONFIG:Debug>,$<Fortran_COMPILER_ID:Intel>>:-check all -fp-model=precise -stand f18 -traceback -warn all,nointerfaces>
$<$<AND:$<CONFIG:Debug>,$<Fortran_COMPILER_ID:IntelLLVM>>:-check all -fp-model=precise -stand f18 -traceback -warn all,nointerfaces>
)
Loading
Loading