Skip to content

Commit

Permalink
merge upstream develop
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelTrahanNOAA committed Apr 11, 2024
2 parents 811c90d + 45c8b2a commit 5bf44a9
Show file tree
Hide file tree
Showing 50 changed files with 2,808 additions and 2,492 deletions.
41 changes: 24 additions & 17 deletions .github/workflows/aux.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Helpers
name: Repo Check
on:
workflow_run:
workflows: ["Pull Request Tests"]
types:
- requested
#workflow_run:
# workflows: ["Pull Request Tests"]
# types:
# - requested
pull_request:
branches:
- develop
env:
app: Accept:application/vnd.github.v3+json
base_url: $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/actions/runs
Expand All @@ -30,24 +33,28 @@ jobs:
steps:
- name: Check up-to-dateness and post comment
run: |
head_sha=${{ github.event.workflow_run.head_sha }}
git clone -q ${{ github.event.workflow_run.head_repository.html_url }} .
trap 'echo "exit-code=$?" >> "$GITHUB_OUTPUT"' EXIT
head_sha=${{ github.event.pull_request.head.sha }}
head_brc=${{ github.event.pull_request.head.ref }}
head_url=${{ github.event.pull_request.head.repo.html_url }}
git clone -q -b $head_brc $head_url .
git checkout -q $head_sha
git submodule -q update --init --recursive
cd ${{ github.workspace }}/tests/ci
url=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY
pr_number=$(curl -sS -H $app $url/pulls \
| jq -r '.[] | select(.head.sha == "'"$head_sha"'") | .number')
echo "pr_number is $pr_number"
pr_uid=${{ github.event.workflow_run.head_repository.owner.login }}
pr_uid=${{ github.event.pull_request.head.repo.owner.login }}
echo "pr_uid is $pr_uid"
comment="$(./repo_check.sh $pr_uid 2>/dev/null)"
echo "comment is $comment"
if [[ -n $comment ]]; then
curl -sS -X POST -H $app -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
$url/issues/$pr_number/comments -d '{"body": "'"${comment}"'"}'
echo -n "failure" >~/repocheck_file
else
echo -n "success" >~/repocheck_file
fi
./repo_check.sh
#comment="$(./repo_check.sh 2>/dev/null)"
#echo "comment is $comment"
#if [[ -n $comment ]]; then
# curl -sS -X POST -H $app -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
# $url/issues/$pr_number/comments -d '{"body": "'"${comment}"'"}'
# echo -n "failure" >~/repocheck_file
#else
# echo -n "success" >~/repocheck_file
#fi
2 changes: 1 addition & 1 deletion FV3
7 changes: 4 additions & 3 deletions NOAHMP-interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ list(APPEND _noahmp_cap_files noahmp/drivers/nuopc/lnd_comp_kind.F90
noahmp/drivers/nuopc/lnd_comp_domain.F90
noahmp/drivers/nuopc/lnd_comp_import_export.F90
noahmp/drivers/nuopc/lnd_comp_nuopc.F90
noahmp/drivers/nuopc/lnd_comp_driver.F90)
noahmp/drivers/nuopc/lnd_comp_driver.F90
noahmp/drivers/nuopc/lnd_comp_cplscalars.F90)

# CCPP interface
# CCPP interface
list(APPEND _noahmp_ccpp_files noahmp/drivers/ccpp/noahmpdrv.F90
noahmp/drivers/ccpp/sfc_diff.f
noahmp/drivers/ccpp/machine.F
Expand All @@ -25,7 +26,7 @@ list(APPEND _noahmp_files noahmp/src/module_sf_noahmplsm.F90
noahmp/src/module_sf_noahmp_glacier.F90)

#------------------------------------------------------------------------------
# Set CCPP flags for C/C++/Fortran preprocessor
# Set CCPP flags for C/C++/Fortran preprocessor
add_definitions(-DCCPP)

#------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion tests/bl_date.conf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export BL_DATE=20240315
export BL_DATE=20240401
204 changes: 103 additions & 101 deletions tests/ci/repo_check.sh
Original file line number Diff line number Diff line change
@@ -1,111 +1,113 @@
#!/bin/bash
set -eu

# This script checks if head repo of PR is up to date with ufs-weather-model develop
# Checks for top level (ufs-weather-model) and next level components (submodules)
result() {
if [[ -n $comment ]]; then
logID=$1
comment="@$logID please bring these up to date with respective authoritative repositories\n"$comment
printf %s "$comment"
#exit 1
fi
#set -eu

get_shas () {
cwd=$(pwd)
# Get sha-1's of the top of develop and feature branches
app="Accept: application/vnd.github.v3+json"
url=$1
gitapi=$2
branch=$3
base_sha=$(curl -sS -H "$app" $gitapi | jq -r '.commit.sha')
workspace=$4
cd $workspace
git remote add upstream $url
git fetch -q upstream $branch
common=$(git merge-base $base_sha @)
echo $common $base_sha $workspace
if [[ $common != $base_sha ]]; then
printf "%s\n\n" "** $workspace **NOT** up to date"
flag_sync=false
fi
cd $cwd
}

# Declare variables
declare -A base fv3 mom6 cice ww3 stoch gocart cmeps cdeps hycom cmake ccpp-framework ccpp-physics atmos_cubed_sphere
submodules="fv3 mom6 cice ww3 stoch gocart cmeps cdeps hycom cmake ccpp-framework ccpp-physics atmos_cubed_sphere"
comment=''
ownerID=$1

# Base branch: this is the top of develop of ufs-weather-model
base[repo]='https://github.com/ufs-community/ufs-weather-model'
base[branch]='develop'

# Submodules to check
fv3[repo]='https://github.com/NOAA-EMC/fv3atm'
fv3[branch]='develop'
fv3[dir]='FV3'

mom6[repo]='https://github.com/NOAA-EMC/MOM6'
mom6[branch]='dev/emc'
mom6[dir]='MOM6-interface/MOM6'

cice[repo]='https://github.com/NOAA-EMC/CICE'
cice[branch]='emc/develop'
cice[dir]='CICE-interface/CICE'

ww3[repo]='https://github.com/NOAA-EMC/WW3'
ww3[branch]='dev/ufs-weather-model'
ww3[dir]='WW3'

stoch[repo]='https://github.com/noaa-psl/stochastic_physics'
stoch[branch]='master'
stoch[dir]='stochastic_physics'

gocart[repo]='https://github.com/GEOS-ESM/GOCART'
gocart[branch]='develop'
gocart[dir]='GOCART'

cmeps[repo]='https://github.com/NOAA-EMC/CMEPS'
cmeps[branch]='emc/develop'
cmeps[dir]='CMEPS-interface/CMEPS'

cdeps[repo]='https://github.com/NOAA-EMC/CDEPS'
cdeps[branch]='develop'
cdeps[dir]='CDEPS-interface/CDEPS'

hycom[repo]='https://github.com/NOAA-EMC/HYCOM-src'
hycom[branch]='emc/develop'
hycom[dir]='HYCOM-interface/HYCOM'

cmake[repo]='https://github.com/NOAA-EMC/CMakeModules'
cmake[branch]='develop'
cmake[dir]='CMakeModules'

ccpp-framework[repo]='https://github.com/NCAR/ccpp-framework'
ccpp-framework[branch]='main'
ccpp-framework[dir]='FV3/ccpp/framework'

ccpp-physics[repo]='https://github.com/ufs-community/ccpp-physics'
ccpp-physics[branch]='ufs/dev'
ccpp-physics[dir]='FV3/ccpp/physics'

#upp[repo]='https://github.com/NOAA-EMC/UPP'
#upp[branch]='develop'
#upp[dir]='upp'

atmos_cubed_sphere[repo]='https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere'
atmos_cubed_sphere[branch]='dev/emc'
atmos_cubed_sphere[dir]='FV3/atmos_cubed_sphere'

# Get sha-1's of the top of develop of ufs-weather-model
app="Accept: application/vnd.github.v3+json"
url="https://api.github.com/repos/ufs-community/ufs-weather-model/branches/develop"
base[sha]=$(curl -sS -H "$app" $url | jq -r '.commit.sha')
flag_sync=true

declare -A urls branches pathes
submodules="base fv3 mom6 cice ww3 stoch cmeps cdeps hycom ccpp_physics aqm noahmp cubed_sphere"

urls[base]='https://github.com/ufs-community/ufs-weather-model'
branches[base]='develop'
pathes[base]=''

urls[fv3]='https://github.com/NOAA-EMC/fv3atm'
branches[fv3]='develop'
pathes[fv3]='FV3'

urls[mom6]='https://github.com/NOAA-EMC/MOM6'
branches[mom6]='dev/emc'
pathes[mom6]='MOM6-interface/MOM6'

urls[cice]='https://github.com/NOAA-EMC/CICE'
branches[cice]='emc/develop'
pathes[cice]='CICE-interface/CICE'

urls[ww3]='https://github.com/NOAA-EMC/WW3'
branches[ww3]='dev/ufs-weather-model'
pathes[ww3]='WW3'

urls[stoch]='https://github.com/noaa-psl/stochastic_physics'
branches[stoch]='master'
pathes[stoch]='stochastic_physics'

urls[gocart]='https://github.com/GEOS-ESM/GOCART'
branches[gocart]='develop'
pathes[gocart]='GOCART'

urls[cmeps]='https://github.com/NOAA-EMC/CMEPS'
branches[cmeps]='emc/develop'
pathes[cmeps]='CMEPS-interface/CMEPS'

urls[cdeps]='https://github.com/NOAA-EMC/CDEPS'
branches[cdeps]='develop'
pathes[cdeps]='CDEPS-interface/CDEPS'

urls[hycom]='https://github.com/NOAA-EMC/HYCOM-src'
branches[hycom]='emc/develop'
pathes[hycom]='HYCOM-interface/HYCOM'

urls[cmake]='https://github.com/NOAA-EMC/CMakeModules'
branches[cmake]='develop'
pathes[cmake]='CMakeModules'

urls[ccpp_physics]='https://github.com/ufs-community/ccpp-physics'
branches[ccpp_physics]='ufs/dev'
pathes[ccpp_physics]='FV3/ccpp/physics'

urls[ccpp_framework]='https://github.com/NCAR/ccpp-framework'
branches[ccpp_framework]='main'
pathes[ccpp_framework]='FV3/ccpp/framework'

urls[aqm]='https://github.com/NOAA-EMC/AQM'
branches[aqm]='develop'
pathes[aqm]='AQM'

urls[noahmp]='https://github.com/NOAA-EMC/noahmp'
branches[noahmp]='develop'
pathes[noahmp]='NOAHMP-interface/noahmp'

#urls[upp]='https://github.com/NOAA-EMC/UPP'
#branches[upp]='develop'
#pathes[upp]='upp'

urls[cubed_sphere]='https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere'
branches[cubed_sphere]='dev/emc'
pathes[cubed_sphere]='FV3/atmos_cubed_sphere'

for submodule in $submodules; do
eval url=https://api.github.com/repos/ufs-community/ufs-weather-model/contents/'${'$submodule'[dir]}'
eval $submodule'[sha]=$(curl -sS -H "$app" $url | jq -r '.sha')'
url=${urls[$submodule]}
branch=${branches[$submodule]}
workspace=${GITHUB_WORKSPACE}'/'${pathes[$submodule]}
gitapi=$(echo "$url" | sed 's/github.com/api.github.com\/repos/g')'/branches/'$branch
get_shas $url $gitapi $branch $workspace
done

# Check if the head branch is up to date with the base branch
cd ${GITHUB_WORKSPACE}
git remote add upstream ${base[repo]}
git fetch -q upstream ${base[branch]}
common=$(git merge-base ${base[sha]} @)
if [[ $common != ${base[sha]} ]]; then
comment="* ufs-weather-model **NOT** up to date\n"
if [[ ! $flag_sync ]]; then
echo "** ${GITHUB_WORKSPACE} **NOT** up to date"
exit 1
fi

for submodule in $submodules; do
eval cd ${GITHUB_WORKSPACE}/'${'$submodule'[dir]}'
eval git remote add upstream '${'$submodule'[repo]}'
eval git fetch -q upstream '${'$submodule'[branch]}'
common=$(eval git merge-base '${'$submodule'[sha]}' @)
if (eval test $common != '${'$submodule'[sha]}'); then
comment+="* $submodule **NOT** up to date\n"
fi
done
echo "** ${GITHUB_WORKSPACE} up to date **"

result $ownerID
exit 0
1 change: 0 additions & 1 deletion tests/default_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,6 @@ export_ww3

# Set CMEPS component defauls
export_cmeps
export ATMTILESIZE=`expr $NPX - 1`

# FV3 defaults
export FRAC_GRID=.true.
Expand Down
Loading

0 comments on commit 5bf44a9

Please sign in to comment.