Skip to content

Commit

Permalink
Add github actions workflow to test SRWA build (ufs-community#152)
Browse files Browse the repository at this point in the history
Currently, there are no Continuous Integration (C.I.) tests for this repository. C.I. tests are considered a software engineering best practice, with numerous benefits to developers as well as the code-base. This PR implements building the ufs-srweather-app as a form of C.I.
  • Loading branch information
Rob Gonzalez-Pita authored Jun 27, 2022
1 parent 3915859 commit 4be97a4
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 23 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/build.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow Builds the UFS Short Range Weather APP
name: Build SRWA

on:
workflow_dispatch:
pull_request:
branches:
- rrfs_ci
types:
- labeled

# Use a default login shell which loads intel/oneapi/setvars.sh, and lmod path
defaults:
run:
shell: bash -l {0}

jobs:

Clone_SRWA:
name: Clone Repo
if: ${{ github.event.label.name == 'ci-aws-intel-build' }}
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
path: ufs-srweather-app-${{ github.run_id }}

- name: Verify Branch
run: |
git branch -a
Build_SRWA:
name: Build SRWA
if: ${{ github.event.label.name == 'ci-aws-intel-build' }}
runs-on: self-hosted
needs: Clone_SRWA

steps:
- name: Build Short Range Weather App using test/build.sh
run: |
cd ufs-srweather-app-${{ github.run_id }}
./manage_externals/checkout_externals
cd test/
./build.sh aws 2>&1 | tee build_test.out
Build_Status:
name: Check Build Sucess or Failure
runs-on: self-hosted
if: ${{ github.event.label.name == 'ci-aws-intel-build' }}
needs: [ Clone_SRWA, Build_SRWA ]

steps:
- name: Get build status
run: |
cd ufs-srweather-app-${{ github.run_id }}/test/
status=`tail -1 build_test.out |cut -d ' ' -f 3-`
if [ $status == PASS ]; then
exit 0
else
exit 1
fi
28 changes: 28 additions & 0 deletions docs/UsersGuide/source/ContinuousIntegration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. _ContinuousIntegration:

======================
Continuous Integration
======================
The Continuous Integration pipeline uses `GitHub Actions Self-Hosted Runners <https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners>`_.
Currently, an `AWS Parallel Cluster <https://aws.amazon.com/hpc/parallelcluster>`_ is configured with all of the dependencies required of the ufs-srweather-app, emulating a NOAA RDHPCS machine.


The following dependencies are currently requirements on the self-hosted runner to build and run automated workflows:

* Python v3.8
* Ruby
* IntelOne API
* Lua
* Lmod
* `hpc-stack <https://github.com/NOAA-EMC/hpc-stack>`_ with all of necessary libraries in ``ufs-srweather-app/env/srw_common``
* Rocoto
* Miniconda3

After creating an AWS ParallelCluster, a ``post-install`` `script <https://github.com/robgonzalezpita/rrfs-ci-pcluster/blob/main/rrfs_ci_post_install.sh>`_
can be executed to automate the installation of these dependencies.

One must then configure this ParallelCluster to be a self-hosted runner as well (which can be done via the `GitHub interface <https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners>`_), in order to pick up the jobs listed in
the GitHub Actions workflow files.

As of now, only a build test has been implemented to verify that the ``ufs-srweather-app`` builds on the self-hosted runner. A test suite consisting of Workflow End to End tests will be added at a later date.

1 change: 0 additions & 1 deletion docs/UsersGuide/source/WE2Etests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -386,4 +386,3 @@ Note the following:
one or more alternate test names are listed, then ``run_WE2E_tests.sh`` will exit
with a warning message without running any tests.


6 changes: 6 additions & 0 deletions etc/lmod-setup.csh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ else if ( "$L_MACHINE" == odin ) then
module --initial_load --no_redirect restore
setenv MODULEPATH "/oldscratch/ywang/external/hpc-stack/modulefiles/mpi/intel/2020/cray-mpich/7.7.16:/oldscratch/ywang/external/hpc-stack/modulefiles/compiler/intel/2020:/oldscratch/ywang/external/hpc-stack/modulefiles/core:/oldscratch/ywang/external/hpc-stack/modulefiles/stack:/opt/cray/pe/perftools/21.02.0/modulefiles:/opt/cray/ari/modulefiles:/opt/cray/pe/craype-targets/default/modulefiles:/opt/cray/pe/modulefiles:/opt/cray/modulefiles:/opt/modulefiles"

else if [ "$L_MACHINE" = aws ]; then
set ENV="/scratch1/apps/lmod/lmod/init/csh"
source $ENV

module purge

else
module purge
endif
Expand Down
6 changes: 6 additions & 0 deletions etc/lmod-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ elif [ "$L_MACHINE" = odin ]; then
module --initial_load --no_redirect restore
export MODULEPATH="/oldscratch/ywang/external/hpc-stack/modulefiles/mpi/intel/2020/cray-mpich/7.7.16:/oldscratch/ywang/external/hpc-stack/modulefiles/compiler/intel/2020:/oldscratch/ywang/external/hpc-stack/modulefiles/core:/oldscratch/ywang/external/hpc-stack/modulefiles/stack:/opt/cray/pe/perftools/21.02.0/modulefiles:/opt/cray/ari/modulefiles:/opt/cray/pe/craype-targets/default/modulefiles:/opt/cray/pe/modulefiles:/opt/cray/modulefiles:/opt/modulefiles"

elif [ "$L_MACHINE" = aws ]; then
export BASH_ENV="/scratch1/apps/lmod/lmod/init/bash"
source $BASH_ENV

module purge

else
module purge
fi
Expand Down
63 changes: 63 additions & 0 deletions modulefiles/build_aws_intel
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#%Module

proc ModulesHelp { } {
puts stderr "This module loads libraries for building SRW on"
puts stderr "AWS ParallelCluster using Intel oneAPI -2021.5.0"
}

module-whatis "Loads libraries needed for building SRW on AWS ParallelCluster"

# Dependant on the install location of hpc-stack modulefiles
module use /scratch1/hpc-stack/modulefiles/stack

module load hpc/1.2.0
module load hpc-intel/2021
# IntelOne API MPI (below)
# module load hpc-impi/2021
# PCluster native intel mpi (version specified when hpc-stack is built)
module load hpc-impi/2019.8.254
module load intelmpi
module load cmake/3.20.1

module load jasper/2.0.25
module load zlib/1.2.11
module load-any png/1.6.35 libpng/1.6.35

module load hdf5/1.10.6
module load netcdf/4.7.4
module load pio/2.5.2
module load esmf/8.2.0
module load fms/2021.03

module load bacio/2.4.1
module load crtm/2.3.0
module load g2/3.4.3
module load g2tmpl/1.10.0
module load ip/3.3.3
module load sp/2.3.3
module load w3nco/2.4.1
module load upp/10.0.10

module load gftl-shared/v1.3.3
module load yafyaml/v0.5.1
module load mapl/2.11.0-esmf-8.2.0

module load gfsio/1.4.1
module load landsfcutil/2.4.1
module load nemsio/2.5.2
module load nemsiogfs/2.5.3
module load sfcio/1.4.1
module load sigio/2.3.2
module load w3emc/2.9.2
module load wgrib2/2.0.8

module load intelmpi
module load libfabric-aws

setenv CMAKE_C_COMPILER mpiicc
setenv CMAKE_CXX_COMPILER mpiicpc
setenv CMAKE_Fortran_COMPILER mpiifort
setenv CMAKE_Platform linux.intel

setenv I_MPI_ROOT /opt/intel/compilers_and_libraries_2020.2.254/linux/mpi
setenv I_MPI_Platform shm:ofa
19 changes: 19 additions & 0 deletions modulefiles/wflow_aws
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#%Module

proc ModulesHelp { } {
put stderr "This module loads python environement for running SRW on"
put stderr "AWS ParallelCluster"
}

module-whatis "Loads libraries needed for running SRW on AWS ParallelCluster"

module load rocoto

module use -a /home/ubuntu/miniconda3/contrib_miniconda3/modulefiles
module load miniconda3

if { [module-info mode load] } {
puts stderr "Please do the following to activate conda:
> conda activate regional_workflow"
}

2 changes: 1 addition & 1 deletion test/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function usage() {
exit 1
}

machines=( hera jet cheyenne orion wcoss_cray wcoss_dell_p3 gaea odin singularity )
machines=( hera jet cheyenne orion wcoss_cray wcoss_dell_p3 gaea odin singularity aws )

[[ $# -eq 2 ]] && usage

Expand Down

0 comments on commit 4be97a4

Please sign in to comment.