-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f896c94
commit be6f39e
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/bash -f | ||
|
||
# Defaults | ||
BRANCH="main" | ||
|
||
# Read command-line args | ||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
-r|--repo-dir) | ||
REPO_DIR="$2" | ||
shift 2 | ||
;; | ||
-b|--branch) | ||
BRANCH="$2" | ||
shift 2 | ||
;; | ||
-s|--slack-webhook-url) | ||
SLACK_WEBHOOK_URL="$2" | ||
shift 2 | ||
;; | ||
*) | ||
echo "Unknown flag" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
# Error if required args are not provided | ||
if [ -z "${REPO_DIR}" ]; then | ||
echo "Error: Repository directory not specified" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${SLACK_WEBHOOK_URL}" ]; then | ||
echo "Error: Slack webhook URL not specified" | ||
exit 1 | ||
fi | ||
|
||
# Pull the latest code | ||
cd $REPO_DIR | ||
git checkout $BRANCH | ||
git pull origin $BRANCH | ||
COMMIT=$(git rev-parse HEAD) | ||
|
||
# Notify start of the test | ||
start_message="Alert: Starting Nightly Ledger Test using Commit \`$COMMIT\` on Branch \`$BRANCH\`" | ||
start_json_payload=$(cat <<EOF | ||
{ | ||
"text": "$start_message" | ||
} | ||
EOF | ||
) | ||
curl -X POST -H 'Content-type: application/json' --data "$start_json_payload" $SLACK_WEBHOOK_URL | ||
|
||
# Set up environment | ||
PATH=/opt/rh/gcc-toolset-12/root/usr/bin:$PATH | ||
export PATH | ||
PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$PKG_CONFIG_PATH | ||
|
||
make distclean && make clean | ||
./deps.sh nuke | ||
echo "y" | ./deps.sh +dev | ||
make -j | ||
|
||
# Run the test | ||
make run-runtime-test-nightly | ||
status=$? | ||
|
||
# Notify the test status | ||
if [ $status -eq 0 ]; then | ||
end_message="Alert: Nightly Ledger Test Passed using Commit \`$COMMIT\` on Branch \`$BRANCH\`" | ||
else | ||
end_message="@here Alert: Nightly Ledger Test Failed using Commit \`$COMMIT\` on Branch \`$BRANCH\`" | ||
fi | ||
|
||
json_payload=$(cat <<EOF | ||
{ | ||
"text": "$end_message", | ||
"link_names": 1 | ||
} | ||
EOF | ||
) | ||
curl -X POST -H 'Content-type: application/json' --data "$json_payload" $SLACK_WEBHOOK_URL |