Skip to content

Commit

Permalink
github/workflows: Add hive on push CI (#12238)
Browse files Browse the repository at this point in the history
Add hive tests to github actions, to be run on push
  • Loading branch information
somnathb1 authored Oct 10, 2024
1 parent 8030a81 commit cbc7be5
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 3 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/hive-nightly.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Hive (Nightly)

on:
schedule:
- cron: "0 01 * * *" # run at 1 am UTC every day
workflow_dispatch:

jobs:
hive:
hive-nightly:
runs-on: ubuntu-latest
steps:
- uses: AutoModality/action-clean@v1
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/test-hive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Test Hive

on:
push:
branches:
- main
- release/*
- docker_pectra
schedule:
- cron: "0 05 * * *" # daily at 5 am UTC
workflow_dispatch:


jobs:
test-hive:
runs-on: ubuntu-latest
steps:
- name: Checkout Hive
uses: actions/checkout@v4
with:
repository: ethereum/hive
# ref: master
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
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 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}-${2}"
echo -e "\n"
./hive --sim ethereum/"${1}" --sim.limit="${2}" --client erigon 2>&1 | tee output.log || {
if [ $? -gt 0 ]; then
echo "Exitcode gt 0"
fi
}
last_line=$(tail -2 output.log | head -1 | sed -r "s/\x1B\[[0-9;]*[a-zA-Z]//g")
suites=$(echo "$last_line" | sed -n 's/.*suites=\([0-9]*\).*/\1/p')
tests=$(echo "$last_line" | sed -n 's/.*tests=\([0-9]*\).*/\1/p')
failed=$(echo "$last_line" | sed -n 's/.*failed=\([0-9]*\).*/\1/p')
echo -e "\n"
echo "----------- Results for ${1}-${2} -----------"
echo "Tests: $tests, Failed: $failed"
echo -e "\n\n============================================================"
if (( tests < 4 )); then
echo "Too few tests run for suite ${1}-${2} - ${tests} tests"
exit 1
fi
if (( failed*2 > tests )); then
echo "Too many failures for suite ${1}-${2} - ${failed} failed out of ${tests}"
exit 1
fi
}
run_suite engine withdrawals
run_suite engine cancun
run_suite engine exchange-capabilities
run_suite engine auth
run_suite engine api
run_suite rpc compat

0 comments on commit cbc7be5

Please sign in to comment.