Skip to content

Commit

Permalink
Merge branch 'develop' into feature/stable-nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
RussTreadon-NOAA committed Nov 19, 2024
2 parents 52c20c4 + 2bcedf2 commit e06890b
Show file tree
Hide file tree
Showing 119 changed files with 4,107 additions and 723 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/hera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
name: Passes on Hera

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/norms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push]

jobs:
check_pynorms:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
name: Check coding norms with pycodestyle and cpplint

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/orion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
name: Passes on Orion

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

jobs:
ctests:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
name: Run Unit Tests with ctest

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittests_g-w.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

jobs:
ctests:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
name: Run Unit Tests inside global-workflow with ctest

steps:
Expand Down
16 changes: 7 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ while getopts "p:t:c:hvdfa" opt; do
done

case ${BUILD_TARGET} in
hera | orion | hercules | wcoss2 | noaacloud | gaea)
hera | orion | hercules | wcoss2 | noaacloud | gaeac5 | gaeac6 )
echo "Building GDASApp on $BUILD_TARGET"
source $dir_root/ush/module-setup.sh
module use $dir_root/modulefiles
Expand Down Expand Up @@ -103,14 +103,12 @@ WORKFLOW_BUILD=${WORKFLOW_BUILD:-"OFF"}
CMAKE_OPTS+=" -DWORKFLOW_TESTS=${WORKFLOW_BUILD}"

# JCSDA changed test data things, need to make a dummy CRTM directory
if [[ $BUILD_TARGET == 'hera' ]]; then
if [ -d "$dir_root/bundle/fix/test-data-release/" ]; then rm -rf $dir_root/bundle/fix/test-data-release/; fi
if [ -d "$dir_root/bundle/test-data-release/" ]; then rm -rf $dir_root/bundle/test-data-release/; fi
mkdir -p $dir_root/bundle/fix/test-data-release/
mkdir -p $dir_root/bundle/test-data-release/
ln -sf $GDASAPP_TESTDATA/crtm $dir_root/bundle/fix/test-data-release/crtm
ln -sf $GDASAPP_TESTDATA/crtm $dir_root/bundle/test-data-release/crtm
fi
if [ -d "$dir_root/bundle/fix/test-data-release/" ]; then rm -rf $dir_root/bundle/fix/test-data-release/; fi
if [ -d "$dir_root/bundle/test-data-release/" ]; then rm -rf $dir_root/bundle/test-data-release/; fi
mkdir -p $dir_root/bundle/fix/test-data-release/
mkdir -p $dir_root/bundle/test-data-release/
ln -sf $GDASAPP_TESTDATA/crtm $dir_root/bundle/fix/test-data-release/crtm
ln -sf $GDASAPP_TESTDATA/crtm $dir_root/bundle/test-data-release/crtm

# Configure
echo "Configuring ..."
Expand Down
139 changes: 82 additions & 57 deletions ci/driver.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash --login

echo "Start at $(date)"

my_dir="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
echo "Set my_dir ${my_dir}"

# ==============================================================================
usage() {
Expand Down Expand Up @@ -51,79 +54,101 @@ esac
cd $GDAS_CI_ROOT/repo
CI_LABEL="${GDAS_CI_HOST}-RT"
gh pr list --label "$CI_LABEL" --state "open" | awk '{print $1;}' > $GDAS_CI_ROOT/open_pr_list

open_pr=`cat $GDAS_CI_ROOT/open_pr_list | wc -l`
if (( $open_pr == 0 )); then
echo "No open PRs with ${CI_LABEL}, exit."
echo "Finish at $(date)"
exit
fi

open_pr_list=$(cat $GDAS_CI_ROOT/open_pr_list)

# ==============================================================================
# clone, checkout, build, test, etc.
repo_url="https://github.com/NOAA-EMC/GDASApp.git"
# loop through all open PRs
for pr in $open_pr_list; do
gh pr edit $pr --remove-label $CI_LABEL --add-label ${CI_LABEL}-Running
echo "Processing Pull Request #${pr}"
echo " "
echo "Start processing Pull Request #${pr} at $(date)"

# get the branch name used for the PR
gdasapp_branch=$(gh pr view $pr --json headRefName -q ".headRefName")

# get the fork information
pr_details=$(gh pr view $pr --repo ${repo_url} --json headRepository,headRepositoryOwner,headRefName)

# extract the necessary info
fork_owner=$(gh pr view $pr --repo ${repo_url} --json headRepositoryOwner --jq '.headRepositoryOwner.login')
fork_name=$(gh pr view $pr --repo ${repo_url} --json headRepository --jq '.headRepository.name')

# construct the fork URL
gdasapp_url="https://github.com/$fork_owner/${fork_name}.git"
# get additional branch information
branch_owner=$(gh pr view $pr --repo ${repo_url} --json headRepositoryOwner --jq '.headRepositoryOwner.login')
branch_name=$(gh pr view $pr --repo ${repo_url} --json headRepository --jq '.headRepository.name')
pr_assignees=$(gh pr view $pr --repo ${repo_url} --json assignees --jq '.assignees[].login')

# check if any assignee is authorized to run CI
authorized_by=""
for str in ${pr_assignees[@]}; do
grep $str /scratch1/NCEPDEV/da/role.jedipara/CI/GDASApp/authorized_users
rc=$?
if (( rc == 0 )); then
authorized_by=${str}
echo "FOUND MATCH $str, rc $rc"
break
fi
done

# Authorized to run CI
if (( rc == 0 )); then
echo "Run CI"

# update PR label
gh pr edit $pr --remove-label $CI_LABEL --add-label ${CI_LABEL}-Running

# construct the fork URL
gdasapp_url="https://github.com/$branch_owner/${branch_name}.git"

echo "Fork URL: $gdasapp_url"
echo "Branch Name: $gdasapp_branch"

# create PR specific directory
if [ -d $GDAS_CI_ROOT/PR/$pr ]; then
rm -rf $GDAS_CI_ROOT/PR/$pr
fi
mkdir -p $GDAS_CI_ROOT/PR/$pr
cd $GDAS_CI_ROOT/PR/$pr

# clone copy of repo
git clone --recursive --jobs 8 --branch $gdasapp_branch $gdasapp_url
cd GDASApp

# checkout pull request
git pull
gh pr checkout $pr
git submodule update --init --recursive

# get commit hash
commit=$(git log --pretty=format:'%h' -n 1)
echo "$commit" > $GDAS_CI_ROOT/PR/$pr/commit

# load modules
case ${TARGET} in
hera | orion)
echo "Loading modules on $TARGET"
module purge
module use $GDAS_CI_ROOT/PR/$pr/GDASApp/modulefiles
module load GDAS/$TARGET
module list
;;
*)
echo "Unsupported platform. Exiting with error."
exit 1
;;
esac

# run build and testing command
$my_dir/run_ci.sh -d $GDAS_CI_ROOT/PR/$pr/GDASApp -o $GDAS_CI_ROOT/PR/$pr/output_${commit}
ci_status=$?
gh pr comment $pr --repo ${repo_url} --body-file $GDAS_CI_ROOT/PR/$pr/output_${commit}
if [ $ci_status -eq 0 ]; then
gh pr edit $pr --repo ${repo_url} --remove-label ${CI_LABEL}-Running --add-label ${CI_LABEL}-Passed
echo "GDASApp URL: $gdasapp_url"
echo "GDASApp branch Name: $gdasapp_branch"
echo "CI authorized by $authorized_by at $(date)"

# create PR specific directory
if [ -d $GDAS_CI_ROOT/PR/$pr ]; then
rm -rf $GDAS_CI_ROOT/PR/$pr
fi
mkdir -p $GDAS_CI_ROOT/PR/$pr
cd $GDAS_CI_ROOT/PR/$pr
pwd

# clone copy of repo
git clone --recursive --jobs 8 --branch $gdasapp_branch $gdasapp_url
cd GDASApp
pwd

# checkout GDASApp pull request
git pull
gh pr checkout $pr
git submodule update --init --recursive

# get commit hash
commit=$(git log --pretty=format:'%h' -n 1)
echo "$commit" > $GDAS_CI_ROOT/PR/$pr/commit

# run build and testing command
echo "Execute $my_dir/run_ci.sh for $GDAS_CI_ROOT/PR/$pr/GDASApp at $(date)"
$my_dir/run_ci.sh -d $GDAS_CI_ROOT/PR/$pr/GDASApp -o $GDAS_CI_ROOT/PR/$pr/output_${commit}
ci_status=$?
echo "After run_ci.sh with ci_status ${ci_status} at $(date)"
gh pr comment $pr --repo ${repo_url} --body-file $GDAS_CI_ROOT/PR/$pr/output_${commit}
if [ $ci_status -eq 0 ]; then
gh pr edit $pr --repo ${repo_url} --remove-label ${CI_LABEL}-Running --add-label ${CI_LABEL}-Passed
else
gh pr edit $pr --repo ${repo_url} --remove-label ${CI_LABEL}-Running --add-label ${CI_LABEL}-Failed
fi

# Not authorized to run CI
else
gh pr edit $pr --repo ${repo_url} --remove-label ${CI_LABEL}-Running --add-label ${CI_LABEL}-Failed
echo "Do NOT run CI"
fi

echo "Finish processing Pull Request #{pr} at $(date)"
done

# ==============================================================================
# scrub working directory for older files
find $GDAS_CI_ROOT/PR/* -maxdepth 1 -mtime +3 -exec rm -rf {} \;

echo "Finish at $(date)"
Loading

0 comments on commit e06890b

Please sign in to comment.