From 95a8b6c679ab5593a429aa0ffd4f1485e4ef08f7 Mon Sep 17 00:00:00 2001 From: Guillaume Vernieres Date: Mon, 8 Jul 2024 18:27:29 -0400 Subject: [PATCH] ... --- ci/gw_driver.sh | 14 +++++++++++++- ci/run_gw_ci.sh | 17 +++++------------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ci/gw_driver.sh b/ci/gw_driver.sh index 1817e522d..0a12300ef 100755 --- a/ci/gw_driver.sh +++ b/ci/gw_driver.sh @@ -50,6 +50,7 @@ esac # pull on the repo and get list of open PRs cd $GDAS_CI_ROOT/repo CI_LABEL="${GDAS_CI_HOST}-GW-RT" +tier2_label="${GDAS_CI_HOST}-GW-RT-tier2" gh pr list --label "$CI_LABEL" --state "open" | awk '{print $1;}' > $GDAS_CI_ROOT/open_pr_list_gw open_pr_list=$(cat $GDAS_CI_ROOT/open_pr_list_gw) @@ -66,6 +67,15 @@ for pr in $open_pr_list; do # get the branch name used for the PR gdasapp_branch=$(gh pr view $pr --json headRefName -q ".headRefName") + # check if we should run the tier-2 tests + pr_number=$(gh pr list --head "$gdasapp_branch" --json number --jq '.[0].number') + all_labels=$(gh pr view "$pr_number" --json labels --jq '.labels[].name') + do_tier2=false + if echo "$all_labels" | grep -q "^$tier2_label$"; then + echo "Tier-2 label found" + do_tier2=true + fi + # check for a companion PR in the global-workflow companion_pr_exists=$(gh pr list --repo ${workflow_url} --head ${gdasapp_branch} --state open) if [ -n "$companion_pr_exists" ]; then @@ -104,7 +114,9 @@ for pr in $open_pr_list; do commit=$(git log --pretty=format:'%h' -n 1) echo "$commit" > $GDAS_CI_ROOT/workflow/PR/$pr/commit - $my_dir/run_gw_ci.sh -d $GDAS_CI_ROOT/workflow/PR/$pr/global-workflow -o $GDAS_CI_ROOT/workflow/PR/$pr/output_${commit} + $my_dir/run_gw_ci.sh -d $GDAS_CI_ROOT/workflow/PR/$pr/global-workflow \ + -o $GDAS_CI_ROOT/workflow/PR/$pr/output_${commit} \ + -t $do_tier2 ci_status=$? gh pr comment $pr --body-file $GDAS_CI_ROOT/workflow/PR/$pr/output_${commit} if [ $ci_status -eq 0 ]; then diff --git a/ci/run_gw_ci.sh b/ci/run_gw_ci.sh index 890042750..ff4a2ba6d 100755 --- a/ci/run_gw_ci.sh +++ b/ci/run_gw_ci.sh @@ -9,6 +9,7 @@ usage() { echo echo " -d Run build and ctest for clone in " echo " -o Path to output message detailing results of CI tests" + echo " -t run the tier-2 testing, default is OFF" echo " -h display this message and quit" echo exit 1 @@ -23,6 +24,9 @@ while getopts "d:o:h" opt; do o) outfile=$OPTARG ;; + t) + do_tier2=${OPTARG:-false} + ;; h|\?|:) usage ;; @@ -37,17 +41,6 @@ echo '```' >> $outfile echo "Start: $(date) on $(hostname)" >> $outfile echo "---------------------------------------------------" >> $outfile # ============================================================================== -# check if the PR needs tier-2 testing to be activated -cd $repodir/sorc/gdas.cd -export GDAS_TIER2_TESTING="OFF" -pr_number=$(gh pr list --head "$branch_name" --json number --jq '.[0].number') -tier2_label="${GDAS_CI_HOST}-GW-RT-tier2" -do_tier2=$(gh pr view "$pr_number" --json labels --jq ".labels | map(select(.name == \"$tier2_label\")) | length > 0") -if [ "$do_tier2" == "true" ]; then - echo "Triggering tier-2 testing" - export GDAS_TIER2_TESTING="ON" -fi - # run build and link as part of the workflow export WORKFLOW_BUILD="ON" cd $repodir/sorc @@ -75,7 +68,7 @@ echo "---------------------------------------------------" >> $outfile # Reconfigure if the tier-2 testing is required # TODO: Not the most efficient, but even when exported, the variable is out of scope # when running build.sh -if [ "$GDAS_TIER2_TESTING" == "ON" ]; then +if [ $do_tier2 == "true" ]; then echo "Tier-2 Testing: Activated" >> $outfile cmake -DGDAS_TIER2_TESTING=ON . >> log.cmake_tier2 fi