join omega nightly #8
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
name: join omega nightly | |
# Nightly action that tests joining omega as a full node. | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 4 * * 1-5" # Weekdays at 4am UTC | |
permissions: | |
contents: read | |
pull-requests: read | |
jobs: | |
join: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 'stable' | |
- name: Run a full node | |
run: | | |
# Build main docker images | |
make build-docker | |
# Install latest omni CLI | |
go install github.com/omni-network/omni/cli/cmd/omni | |
# init halo and geth | |
~/go/bin/omni operator init-nodes --network=omega --moniker=ci-nightly --home=$(pwd) | |
# start halo and geth | |
docker compose up -d | |
- name: Wait for sync | |
run: | | |
t0=$(date +%s) # Record the start time | |
while true; do | |
ELAPSED=$(($(date +%s) - t0)) # Calculate the elapsed time in seconds | |
ELAPSED_FMT="$((ELAPSED / 3600))h$(( (ELAPSED % 3600) / 60 ))m" | |
# If more than 6 hours (21600 seconds) have passed, exit with a failure message | |
if [ ${ELAPSED} -gt 21600 ]; then | |
echo "Node not synced after 6 hours, failing" | |
exit 1 | |
fi | |
# Get and print halo's health status | |
STATUS=$(docker inspect --format "{{json .State.Health.Status }}" halo | sed 's/"//g') | |
echo "$(date +'%H:%M:%S') status=${STATUS} elapsed=${ELAPSED_FMT}" | |
# If the container is "healthy", it has synced, we are done | |
if [ "${STATUS}" == "healthy" ]; then | |
echo "Node synced" | |
break | |
fi | |
# Wait for 30 seconds before checking again | |
sleep 30 | |
done | |
- name: Stop the node | |
if: always() | |
run: docker compose down |