Supported Stages/2024 and added a basic CI test #69
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: TSMP2 Build | |
# Controls when the action will run. | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
eclm_build_job: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-22.04 ] | |
config: | |
- { | |
name: "eCLM-ParFlow", | |
} | |
env: | |
CC: mpicc | |
CXX: mpicxx | |
FC: mpifort | |
F77: mpif77 | |
BUILD_DIR: bld | |
INSTALL_DIR: install | |
MODEL_DIR: ${{ github.workspace }}/component-models | |
VER_OASIS: tsmp-patches-v0.1 | |
VER_eCLM: beta-0.1 | |
VER_PARFLOW: 499ea4465e91aab96261679f3c26b3d73b159892 # points to commit "Upgrade OASIS3-MCT CI to Ubuntu22.04" | |
VER_HYPRE: 2.26.0 | |
VER_NETCDF_C: 4.9.2 | |
VER_NETCDF_F90: 4.6.1 | |
CMAKE_PREFIX_PATH: ${{ github.workspace }}/dependencies | |
SYSTEMNAME: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install TSMP2 dependencies on Ubuntu | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: libxml++2.6-dev pylint wget cmake libpnetcdf-dev tcl-dev tk-dev | |
version: 1.0 | |
execute_install_scripts: true | |
- name: Download HDF5 headers and MPI Fortran compiler | |
run: sudo apt-get install gfortran openmpi-bin libopenmpi-dev libhdf5-openmpi-dev libhdf5-openmpi-103 hdf5-helpers | |
- name: Create directories for component model and dependencies | |
run: | | |
mkdir -p ${CMAKE_PREFIX_PATH} ${MODEL_DIR} | |
# | |
# NetCDF C | |
# | |
- name: Restore cached NetCDF C ${{ env.VER_NETCDF_C }} | |
uses: actions/cache/restore@v4 | |
id: cache-netcdf-restore | |
with: | |
path: ${{ env.CMAKE_PREFIX_PATH }} | |
key: cache-${{ matrix.config.name }}-${{ env.VER_NETCDF_C }} | |
- if: steps.cache-netcdf-restore.outputs.cache-hit != 'true' | |
name: Install NetCDF C ${{ env.VER_NETCDF_C }} | |
run: | | |
wget https://github.com/Unidata/netcdf-c/archive/v${VER_NETCDF_C}.tar.gz | |
tar xf v${VER_NETCDF_C}.tar.gz | |
cd netcdf-c-${VER_NETCDF_C} | |
export CPPFLAGS=-I/usr/include/hdf5/openmpi | |
export LDFLAGS=-L/usr/lib/x86_64-linux-gnu/hdf5/openmpi | |
./configure --prefix=$(realpath $CMAKE_PREFIX_PATH) | |
make -j4 install | |
- if: steps.cache-netcdf-restore.outputs.cache-hit != 'true' | |
name: Cache NetCDF ${{ env.VER_NETCDF_C }} | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.CMAKE_PREFIX_PATH }} | |
key: cache-${{ matrix.config.name }}-${{ env.VER_NETCDF_C }} | |
# | |
# NetCDF Fortran | |
# | |
- name: Restore cached NetCDF Fortran ${{ env.VER_NETCDF_F90 }} | |
uses: actions/cache/restore@v4 | |
id: cache-netcdff90-restore | |
with: | |
path: ${{ env.CMAKE_PREFIX_PATH }} | |
key: cache-${{ matrix.config.name }}-${{ env.VER_NETCDF_F90 }} | |
- if: steps.cache-netcdff90-restore.outputs.cache-hit != 'true' | |
name: Install NetCDF Fortran ${{ env.VER_NETCDF_F90 }} | |
run: | | |
wget https://github.com/Unidata/netcdf-fortran/archive/v${VER_NETCDF_F90}.tar.gz | |
tar xf v${VER_NETCDF_F90}.tar.gz | |
cd netcdf-fortran-${VER_NETCDF_F90} | |
export CPPFLAGS=-I${CMAKE_PREFIX_PATH}/include | |
export LDFLAGS=-L${CMAKE_PREFIX_PATH}/lib | |
./configure --prefix=$(realpath $CMAKE_PREFIX_PATH) | |
make -j4 install | |
- if: steps.cache-netcdff90-restore.outputs.cache-hit != 'true' | |
name: Cache NetCDF Fortran ${{ env.VER_NETCDF_F90 }} | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.CMAKE_PREFIX_PATH }} | |
key: cache-${{ matrix.config.name }}-${{ env.VER_NETCDF_F90 }} | |
# | |
# OASIS3-MCT | |
# | |
- name: Restore cached OASIS3-MCT ${{ env.VER_OASIS }} | |
uses: actions/cache/restore@v4 | |
id: cache-oasis-restore | |
with: | |
path: ${{ env.MODEL_DIR }}/oasis3-mct | |
key: cache-${{ matrix.config.name }}-${{ env.VER_OASIS }} | |
- if: steps.cache-oasis-restore.outputs.cache-hit != 'true' | |
name: Download OASIS3-MCT ${{ env.VER_OASIS }} | |
working-directory: ${{ env.MODEL_DIR }} | |
run: | | |
git clone -b $VER_OASIS https://icg4geo.icg.kfa-juelich.de/ExternalReposPublic/oasis3-mct.git | |
echo "OASIS3-MCT version: $(cd oasis3-mct && git describe --tags --always)" | |
- if: steps.cache-oasis-restore.outputs.cache-hit != 'true' | |
name: Cache OASIS3-MCT ${{ env.VER_OASIS }} | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.MODEL_DIR }}/oasis3-mct | |
key: cache-${{ matrix.config.name }}-${{ env.VER_OASIS }} | |
# | |
# eCLM | |
# | |
- name: Restore cached eCLM ${{ env.VER_eCLM }} | |
uses: actions/cache/restore@v4 | |
id: cache-eclm-restore | |
with: | |
path: ${{ env.MODEL_DIR }}/eCLM | |
key: cache-${{ matrix.config.name }}-${{ env.VER_eCLM }} | |
- if: steps.cache-eclm-restore.outputs.cache-hit != 'true' | |
name: Download eCLM ${{ env.VER_eCLM }} | |
working-directory: ${{ env.MODEL_DIR }} | |
run: | | |
git clone -b $VER_eCLM https://github.com/HPSCTerrSys/eCLM.git | |
echo "eCLM version: $(cd eCLM && git describe --tags --always)" | |
- if: steps.cache-eclm-restore.outputs.cache-hit != 'true' | |
name: Cache eCLM ${{ env.VER_eCLM }} | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.MODEL_DIR }}/eCLM | |
key: cache-${{ matrix.config.name }}-${{ env.VER_eCLM }} | |
# | |
# ParFlow | |
# | |
- name: Restore cached ParFlow ${{ env.VER_PARFLOW }} | |
uses: actions/cache/restore@v4 | |
id: cache-parflow-restore | |
with: | |
path: ${{ env.MODEL_DIR }}/parflow | |
key: cache-${{ matrix.config.name }}-${{ env.VER_PARFLOW }} | |
# TODO: Must use upstream repo https://github.com/parflow/parflow.git | |
- if: steps.cache-parflow-restore.outputs.cache-hit != 'true' | |
name: Download ParFlow ${{ env.VER_PARFLOW }} | |
working-directory: ${{ env.MODEL_DIR }} | |
run: | | |
git clone https://github.com/parflow/parflow.git | |
cd parflow | |
git checkout $VER_PARFLOW | |
echo "ParFlow version: $(git describe --tags --always)" | |
- if: steps.cache-parflow-restore.outputs.cache-hit != 'true' | |
name: Cache ParFlow ${{ env.VER_PARFLOW }} | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.MODEL_DIR }}/parflow | |
key: cache-${{ matrix.config.name }}-${{ env.VER_PARFLOW }} | |
# | |
# Hypre | |
# | |
- name: Restore cached Hypre ${{ env.VER_HYPRE }} | |
uses: actions/cache/restore@v4 | |
id: cache-hypre-restore | |
with: | |
path: ${{ env.CMAKE_PREFIX_PATH }} | |
key: cache-${{ matrix.config.name }}-${{ env.VER_HYPRE }} | |
- if: steps.cache-hypre-restore.outputs.cache-hit != 'true' | |
name: Install Hypre ${{ env.VER_HYPRE }} | |
run: | | |
wget https://github.com/hypre-space/hypre/archive/v${VER_HYPRE}.tar.gz | |
tar xf v${VER_HYPRE}.tar.gz | |
cd hypre-${VER_HYPRE}/src | |
./configure --prefix=$(realpath $CMAKE_PREFIX_PATH) | |
make -j4 install | |
- if: steps.cache-hypre-restore.outputs.cache-hit != 'true' | |
name: Cache Hypre ${{ env.VER_HYPRE }} | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.CMAKE_PREFIX_PATH }} | |
key: cache-${{ matrix.config.name }}-${{ env.VER_HYPRE }} | |
# | |
# TSMP2 | |
# | |
- name: Configure TSMP2 | |
run: >- | |
cmake -S . -B ${BUILD_DIR} | |
-DCMAKE_BUILD_TYPE="RELEASE" | |
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} | |
-DOASIS_SRC=${MODEL_DIR}/oasis3-mct | |
-DeCLM="ON" | |
-DeCLM_SRC=${MODEL_DIR}/eCLM | |
-DParFlow="ON" | |
-DPARFLOW_SRC=${MODEL_DIR}/parflow | |
- name: Build TSMP2 | |
run: | | |
cmake --build ${BUILD_DIR} | |
- name: Install TSMP2 | |
run: | | |
cmake --install ${BUILD_DIR} |