Skip to content

Commit

Permalink
workflows: Add ethereum/eest separate workflow (#12599) (#12614)
Browse files Browse the repository at this point in the history
Cherry pick #12599
  • Loading branch information
somnathb1 authored Nov 4, 2024
1 parent 4b602ca commit 2b248ca
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 2 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/test-hive-eest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Hive EEST tests

on:
push:
branches:
- release/*
- main
workflow_dispatch:

jobs:
test-hive-eest:
runs-on: ubuntu-latest
steps:
- name: Checkout Hive
uses: actions/checkout@v4
with:
repository: danceratopz/hive
ref: prague-devnet-4
path: hive
- name: Setup go env and cache
uses: actions/setup-go@v5
with:
go-version: '>=1.22'
go-version-file: 'hive/go.mod'

# Targetting the clients/erigon/Dockerfile.git in the Hive director -
# this builds the container from github and uses it for tests
- name: Get dependencies and build hive
run: |
cd hive
git status
go get . >> buildlogs.log
rm clients/erigon/Dockerfile
mv clients/erigon/Dockerfile.git clients/erigon/Dockerfile
branch_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/[&/\]/\\&/g')
echo Building Hive with Erigon branch - $branch_name
sed -i "s/^ARG github=ledgerwatch\/erigon$/ARG github=erigontech\/erigon/" clients/erigon/Dockerfile
sed -i "s/^ARG tag=main$/ARG tag=${branch_name}/" clients/erigon/Dockerfile
if [[ "$branch_name" != "main" ]]; then
sed -i "/$sync.parallel-state-flushing/d" clients/erigon/erigon.sh
fi
go build . >> buildlogs.log
# Depends on the last line of hive output that prints the number of suites, tests and failed
# Currently, we fail even if suites and tests are too few, indicating the tests did not run
# We also fail if more than half the tests fail
- name: Run hive tests and parse output
run: |
cd hive
run_suite() {
echo -e "\n\n============================================================"
echo "Running test: ${1}"
echo -e "\n"
./hive --sim 'ethereum/eest/consume-engine' --client erigon 2>&1 | tee output.log || {
if [ $? -gt 0 ]; then
echo "Exitcode gt 0"
fi
}
status_line=$(tail -2 output.log | head -1 | sed -r "s/\x1B\[[0-9;]*[a-zA-Z]//g")
suites=$(echo "$status_line" | sed -n 's/.*suites=\([0-9]*\).*/\1/p')
if [ -z "$suites" ]; then
status_line=$(tail -1 output.log | sed -r "s/\x1B\[[0-9;]*[a-zA-Z]//g")
suites=$(echo "$status_line" | sed -n 's/.*suites=\([0-9]*\).*/\1/p')
fi
tests=$(echo "$status_line" | sed -n 's/.*tests=\([0-9]*\).*/\1/p')
failed=$(echo "$status_line" | sed -n 's/.*failed=\([0-9]*\).*/\1/p')
echo -e "\n"
echo "----------- Results for ${1} -----------"
echo "Tests: $tests, Failed: $failed"
echo -e "\n\n============================================================"
if (( tests < 4 )); then
echo "Too few tests run for suite ${1} - ${tests} tests"
exit 1
fi
if (( failed*2 > tests )); then
echo "Too many failures for suite ${1} - ${failed} failed out of ${tests}"
exit 1
fi
}
run_suite eest/consume-engine
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,13 @@ test-integration: test-erigon-lib
$(GOTEST) --timeout 240m -tags $(BUILD_TAGS),integration

## test-hive run the hive tests locally off nektos/act workflows simulator
test-hive:
test-hive:
@if ! command -v act >/dev/null 2>&1; then \
echo "act command not found in PATH, please source it in PATH. If nektosact is not installed, install it by visiting https://nektosact.com/installation/index.html"; \
elif [ -z "$(GITHUB_TOKEN)"]; then \
echo "Please export GITHUB_TOKEN var in the environment"; \
echo "Please export GITHUB_TOKEN var in the environment" ; \
elif [ "$(SUITE)" = "eest" ]; then \
act -j test-hive-eest -s GITHUB_TOKEN=$(GITHUB_TOKEN) ; \
else \
act -j test-hive -s GITHUB_TOKEN=$(GITHUB_TOKEN) ; \
fi
Expand Down

0 comments on commit 2b248ca

Please sign in to comment.