-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
3 changed files
with
78 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Testnet Deployment CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
testnet: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Set up Go 1.23.0 | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.23.0' | ||
|
||
- name: Install JQ | ||
run: sudo apt-get install jq | ||
|
||
- name: Build dependencies | ||
run: ./build-dependencies.sh | ||
|
||
- name: Start Testnet | ||
run: | | ||
./node.sh & | ||
sleep 60 | ||
- name: Run Health check | ||
run: ./healthcheck.sh |
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,39 @@ | ||
#!/bin/bash | ||
|
||
BEACON_CONFIG_DIR=./config/beacond | ||
BEACOND_BINARY=./dependencies/beacon-kit/build/bin/beacond | ||
INTERVAL=5 # Interval in seconds between checks | ||
TRIES=5 # Number of times to check | ||
|
||
# Initialize the previous block height | ||
previous_block_height=0 | ||
|
||
for ((i = 1; i <= TRIES; i++)); do | ||
# Get the latest block height | ||
latest_block_height=$($BEACOND_BINARY --home=$BEACON_CONFIG_DIR status | jq -r .sync_info.latest_block_height) | ||
|
||
# Validate the block height is a number | ||
if ! [[ "$latest_block_height" =~ ^[0-9]+$ ]]; then | ||
echo "Error: Failed to fetch latest_block_height. Received: $latest_block_height" | ||
exit 1 | ||
fi | ||
|
||
echo "Check $i: Latest Block Height = $latest_block_height" | ||
|
||
# Compare with the previous block height | ||
if (( i > 1 )) && (( latest_block_height <= previous_block_height )); then | ||
echo "Block height is not increasing (previous: $previous_block_height, current: $latest_block_height)." | ||
exit 1 | ||
fi | ||
|
||
# Update the previous block height | ||
previous_block_height=$latest_block_height | ||
|
||
# Sleep before the next iteration (skip sleep after the last iteration) | ||
if (( i < TRIES )); then | ||
sleep $INTERVAL | ||
fi | ||
done | ||
|
||
echo "Block height is increasing consistently over $TRIES checks." | ||
exit 0 |
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