Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Jul 8, 2024
1 parent 02bb8d9 commit 95a8b6c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
14 changes: 13 additions & 1 deletion ci/gw_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 5 additions & 12 deletions ci/run_gw_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ usage() {
echo
echo " -d Run build and ctest for clone in <directory>"
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
Expand All @@ -23,6 +24,9 @@ while getopts "d:o:h" opt; do
o)
outfile=$OPTARG
;;
t)
do_tier2=${OPTARG:-false}
;;
h|\?|:)
usage
;;
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 95a8b6c

Please sign in to comment.