Skip to content

Commit

Permalink
add print log run fx
Browse files Browse the repository at this point in the history
  • Loading branch information
chapman39 committed Jan 17, 2025
1 parent a029d3e commit b5ce89b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions scripts/shared-macmini/build-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,27 @@ OUTPUT_LOG="$CI_ROOT_DIR/logs/macmini-build-and-test-$(date +"%Y_%m_%d_%H_%M_%S"
HOST_CONFIG="$CI_ROOT_DIR/host-configs/firion-darwin-sonoma-aarch64-clang@14.0.6.cmake"
RECIPIENTS="chapman39@llnl.gov,white238@llnl.gov,talamini1@llnl.gov"

print_run_log(){
echo "####################" >> "$OUTPUT_LOG"
echo "# $@" >> "$OUTPUT_LOG"
echo "####################" >> "$OUTPUT_LOG"
"$@" >> "$OUTPUT_LOG" 2>&1
echo >> "$OUTPUT_LOG"
}

# Go to project directory
cd $PROJECT_DIR
print_run_log cd $PROJECT_DIR

# Update Serac
git checkout task/chapman39/macmini-build >> $OUTPUT_LOG 2>&1 # TODO CHANGE TO DEVELOP
git pull >> $OUTPUT_LOG 2>&1
git submodule update --init --recursive >> $OUTPUT_LOG 2>&1
print_run_log git checkout develop
print_run_log git pull
print_run_log git submodule update --init --recursive

# Clear previous build(s)
rm -rf _serac_build_and_test* >> $OUTPUT_LOG 2>&1
print_run_log rm -rf _serac_build_and_test*

# Build and test Serac
python3 ./scripts/llnl/build_src.py --host-config $HOST_CONFIG -v -j16 >> $OUTPUT_LOG 2>&1
print_run_log python3 ./scripts/llnl/build_src.py --host-config $HOST_CONFIG -v -j16

# Email variables
if [ $? -eq 0 ]; then
Expand All @@ -36,4 +44,4 @@ EMAIL_SUBJECT="$EMAIL_SUBJECT MacMini build and test report $(date)"
EMAIL_BODY="This is automatic weekly report of Serac's MacMini build. See attached for log."

# Send report via email
echo "$EMAIL_BODY" | mutt -a "$OUTPUT_LOG" -s "$EMAIL_SUBJECT" -- "$RECIPIENTS"
echo "$EMAIL_BODY" | print_run_log mutt -a "$OUTPUT_LOG" -s "$EMAIL_SUBJECT" -- "$RECIPIENTS"

0 comments on commit b5ce89b

Please sign in to comment.