Skip to content

Commit aef5960

Browse files
committed
Containerize unit testing CI jobs in MPAS dynamical core
1 parent ea7a558 commit aef5960

1 file changed

Lines changed: 20 additions & 38 deletions

File tree

.github/workflows/mpas_dynamical_core_ci.yml

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -233,70 +233,52 @@ jobs:
233233
path: ${{ env.SOURCE_CODE_PATH }}/source-code-linting.log
234234
retention-days: 7
235235
unit-tests:
236-
name: Build and run unit tests (GCC ${{ matrix.gcc-version }})
236+
name: Build and run unit tests (${{ matrix.compiler }})
237237
timeout-minutes: 10
238238
strategy:
239239
fail-fast: false
240240
matrix:
241-
gcc-version:
242-
- '12'
243-
- '13'
244-
- '14'
241+
compiler:
242+
- gnu-11
243+
- gnu-12
244+
- gnu-13
245+
- gnu-14
246+
- gnu-15
247+
- intel-2024
248+
- intel-2025
249+
# The unit tests in MPAS dynamical core currently do not involve any MPI functionalities.
250+
# Testing with a single MPI implementation is sufficient for now.
251+
mpi:
252+
- open-mpi-5
245253
runs-on: ubuntu-24.04
254+
container:
255+
image: ghcr.io/kuanchihwang/atm-sci-container:2026-04-12_${{ matrix.compiler }}_${{ matrix.mpi }}
246256
needs: conditional-check
247257
if: ${{ needs.conditional-check.outputs.should-run == 'true' }}
248258
env:
249-
CC: gcc-${{ matrix.gcc-version }}
250-
CXX: g++-${{ matrix.gcc-version }}
251-
FC: gfortran-${{ matrix.gcc-version }}
252-
PFUNIT_BUILD_TYPE: Release
253-
PFUNIT_PATH: ${{ github.workspace }}/pFUnit
254-
PFUNIT_REFERENCE: 'v4.13.0'
259+
CONTAINER_ENVIRONMENT: pfunit
255260
UNIT_TESTS_BUILD_TYPE: Debug
256261
UNIT_TESTS_PATH: ${{ github.workspace }}/src/dynamics/mpas
257262
steps:
258263
- name: Checkout CAM-SIMA
259264
uses: actions/checkout@v6
260265

261-
# pFUnit takes a while to build. Cache it if possible to save time on consecutive workflow runs.
262-
- name: Cache pFUnit
263-
id: cache-pfunit
264-
uses: actions/cache@v5
265-
with:
266-
key: cache-pfunit-${{ env.PFUNIT_REFERENCE }}-gcc-v${{ matrix.gcc-version }}-mpas
267-
path: ${{ env.PFUNIT_PATH }}/install
268-
269-
# If there is a cache hit, just use the cached pFUnit and skip this step.
270-
- name: Checkout pFUnit
271-
if: ${{ steps.cache-pfunit.outputs.cache-hit != 'true' }}
272-
uses: actions/checkout@v6
273-
with:
274-
repository: Goddard-Fortran-Ecosystem/pFUnit
275-
ref: ${{ env.PFUNIT_REFERENCE }}
276-
path: pFUnit
277-
278-
# If there is a cache hit, just use the cached pFUnit and skip this step.
279-
- name: Build pFUnit
280-
if: ${{ steps.cache-pfunit.outputs.cache-hit != 'true' }}
281-
run: |
282-
cmake -D CMAKE_BUILD_TYPE="$PFUNIT_BUILD_TYPE" -D CMAKE_INSTALL_PREFIX="$PFUNIT_PATH/install" -B "$PFUNIT_PATH/build" -S "$PFUNIT_PATH"
283-
cmake --build "$PFUNIT_PATH/build" --config "$PFUNIT_BUILD_TYPE"
284-
cmake --install "$PFUNIT_PATH/build" --config "$PFUNIT_BUILD_TYPE" --prefix "$PFUNIT_PATH/install"
285-
286266
- name: Build unit tests
287267
run: |
288-
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"
268+
source "$(command -v container-entrypoint-hook.sh)"
269+
cmake -D CMAKE_BUILD_TYPE="$UNIT_TESTS_BUILD_TYPE" -B "$UNIT_TESTS_PATH/build" -S "$UNIT_TESTS_PATH"
289270
cmake --build "$UNIT_TESTS_PATH/build" --config "$UNIT_TESTS_BUILD_TYPE"
290271
291272
- name: Run unit tests
292273
run: |
274+
source "$(command -v container-entrypoint-hook.sh)"
293275
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
294276
295277
- name: Upload unit tests log
296278
if: ${{ always() }}
297279
uses: actions/upload-artifact@v7
298280
with:
299281
if-no-files-found: ignore
300-
name: unit-tests-log-gcc-v${{ matrix.gcc-version }}
282+
name: unit-tests-log-${{ matrix.compiler }}
301283
path: ${{ env.UNIT_TESTS_PATH }}/build/unit-tests.log
302284
retention-days: 7

0 commit comments

Comments
 (0)