Skip to content

Commit

Permalink
CI: Switch Fix chiado test failures and switch action to matrix setup (
Browse files Browse the repository at this point in the history
…#6083)

* Disable chiaro wait step and output the logs

* allow triggers for all branches

* fetch logs from within sedge directory

* switch CL to lodestar

* invalid CL client?

* try teku CL

* change cl url flag

* switch back to lodestar

* revert back to the lighthouse CL and add sepolia back

* add logging back

* try default lighthouse CL

* switch to matrix

* Revert debugging changes

* Set YAML indentation

* Apply correct indentation

---------

Co-authored-by: Ruben Buniatyan <[email protected]>
  • Loading branch information
brbrr and rubo authored Sep 11, 2023
1 parent fad0455 commit fd66055
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 116 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ indent_size = 2
[*.sh]
indent_size = 2

# YAML files
[*.{yml,yaml}]
indent_size = 2

###############################
# Override Visual Studio #
###############################
Expand Down
144 changes: 28 additions & 116 deletions .github/workflows/sync-testnets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,38 @@ name: Sync Testnets

on:
push:
branches: ["master"]
branches: [master]
workflow_dispatch:

env:
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: "1"
TERM: xterm

jobs:
chiado:
name: "Run sync of chiado testnet"
testnet-sync:
strategy:
matrix:
include:
- network: "chiado"
checkpoint-sync-url: "http://139.144.26.89:4000/"
cl-client: "lighthouse"
el-client: "nethermind:current_branch_image"
- network: "sepolia"
checkpoint-sync-url: "https://beaconstate-sepolia.chainsafe.io"
cl-client: "lighthouse"
el-client: "nethermind:current_branch_image"
name: "Run sync of ${{ matrix.network }} testnet"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Configure settings
id: settings
run: |
echo "BUILD_TIMESTAMP=$(date '+%s')" >> $GITHUB_OUTPUT
echo "COMMIT_HASH=$(git describe --always --exclude=* --abbrev=40)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand All @@ -47,150 +58,51 @@ jobs:
echo 'Generating sedge docker...'
./build/sedge deps install
./build/sedge generate --logging none -p $GITHUB_WORKSPACE/sedge \
full-node --map-all --no-mev-boost --no-validator --network chiado \
-c lighthouse:sigp/lighthouse:latest -e nethermind:current_branch_image \
full-node --map-all --no-mev-boost --no-validator --network ${{ matrix.network }} \
-c ${{ matrix.cl-client }} -e ${{ matrix.el-client }} \
--el-extra-flag Sync.NonValidatorNode=true --el-extra-flag Sync.DownloadBodiesInFastSync=false \
--el-extra-flag Sync.DownloadReceiptsInFastSync=false \
--el-extra-flag JsonRpc.EnabledModules=[Eth,Subscribe,Trace,TxPool,Web3,Personal,Proof,Net,Parity,Health,Rpc,Debug] \
--cl-extra-flag checkpoint-sync-url=http://139.144.26.89:4000/
--checkpoint-sync-url=${{ matrix.checkpoint-sync-url }}
echo 'Running sedge...'
docker compose up -d
- name: Wait for Chiado to sync
- name: Wait for ${{ matrix.network }} to sync
id: wait
timeout-minutes: 90
run: |
set +e
declare -A bad_logs
bad_logs["Invalid"]=1
bad_logs["Exception"]=1
bad_logs["Corrupted"]=1

declare -A good_logs
good_logs["Synced chain Head"]=0
good_logs["Processed"]=0

declare -A required_count
required_count["Synced chain Head"]=20
required_count["Processed"]=20

echo "Starting Docker logs monitoring..."
docker logs -f sedge-execution-client | while read -r line; do
echo "$line"

for bad_log in "${!bad_logs[@]}"; do
if [[ "$line" == *"$bad_log"* ]]; then
echo "Error: $bad_log found in Docker logs."
exit 1
fi
done

for good_log in "${!good_logs[@]}"; do
if [[ "$line" == *"$good_log"* ]]; then
((good_logs["$good_log"]++))
fi
done

# Check if all good logs have reached the required count
all_reached_required_count=true
for good_log in "${!good_logs[@]}"; do
if [[ ${good_logs[$good_log]} -lt ${required_count[$good_log]} ]]; then
all_reached_required_count=false
break
fi
done

if $all_reached_required_count; then
echo "All required logs found."
break
fi
done

echo "Node is synced."

sepolia:
name: "Run sync of sepolia testnet"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Configure settings
id: settings
run: |
echo "BUILD_TIMESTAMP=$(date '+%s')" >> $GITHUB_OUTPUT
echo "COMMIT_HASH=$(git describe --always --exclude=* --abbrev=40)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build docker image
run: docker buildx build --platform=linux/amd64 -t current_branch_image -f Dockerfile --build-arg COMMIT_HASH=${{ steps.settings.outputs.COMMIT_HASH }} --build-arg BUILD_TIMESTAMP=${{ steps.settings.outputs.BUILD_TIMESTAMP}} --load .

- name: Setup Go environment
uses: actions/[email protected]
- name: Install Sedge environment
run: |
echo "Downloading sedge sources..."
git clone https://github.com/NethermindEth/sedge.git sedge --branch main --single-branch
echo "Sources downloaded."
cd sedge
echo "Building sedge..."
make compile
- name: Run Sedge
working-directory: sedge
run: |
echo 'Generating sedge docker...'
./build/sedge deps install
./build/sedge generate --logging none -p $GITHUB_WORKSPACE/sedge \
full-node --map-all --no-mev-boost --no-validator --network sepolia \
-c lighthouse:sigp/lighthouse:latest -e nethermind:current_branch_image \
--el-extra-flag Sync.NonValidatorNode=true --el-extra-flag Sync.DownloadBodiesInFastSync=false \
--el-extra-flag Sync.DownloadReceiptsInFastSync=false \
--el-extra-flag JsonRpc.EnabledModules=[Eth,Subscribe,Trace,TxPool,Web3,Personal,Proof,Net,Parity,Health,Rpc,Debug] \
--cl-extra-flag checkpoint-sync-url=https://beaconstate-sepolia.chainsafe.io
echo 'Running sedge...'
docker compose up -d
- name: Wait for Sepolia to sync
id: wait
timeout-minutes: 90
run: |
set +e
declare -A bad_logs
bad_logs["Invalid"]=1
bad_logs["Exception"]=1
bad_logs["Corrupted"]=1
declare -A good_logs
good_logs["Synced chain Head"]=0
good_logs["Processed"]=0
declare -A required_count
required_count["Synced chain Head"]=20
required_count["Processed"]=20
echo "Starting Docker logs monitoring..."
docker logs -f sedge-execution-client | while read -r line; do
echo "$line"
for bad_log in "${!bad_logs[@]}"; do
if [[ "$line" == *"$bad_log"* ]]; then
echo "Error: $bad_log found in Docker logs."
exit 1
fi
done
for good_log in "${!good_logs[@]}"; do
if [[ "$line" == *"$good_log"* ]]; then
((good_logs["$good_log"]++))
fi
done
# Check if all good logs have reached the required count
all_reached_required_count=true
for good_log in "${!good_logs[@]}"; do
Expand All @@ -199,11 +111,11 @@ jobs:
break
fi
done
if $all_reached_required_count; then
echo "All required logs found."
break
fi
done
echo "Node is synced."

0 comments on commit fd66055

Please sign in to comment.