Skip to content

Fix hive tests (#8139) #2458

Fix hive tests (#8139)

Fix hive tests (#8139) #2458

Workflow file for this run

name: Hive tests
on:
push:
tags: ['*']
branches: [master]
workflow_dispatch:
inputs:
test-suite:
description: Test suite
required: true
default: ethereum/engine
type: choice
options:
- devp2p
- ethereum/consensus
- ethereum/engine
- ethereum/graphql
- ethereum/eest
- ethereum/rpc
- ethereum/rpc-compat
- ethereum/sync
limit:
description: Limit
required: false
type: string
log-level:
description: Log level
required: true
default: '3'
type: choice
options: ['0', '1', '2', '3', '4', '5']
hive-repo:
description: Hive repo
required: true
default: ethereum/hive
type: string
hive-branch:
description: Hive branch
required: false
default: master
type: string
buildarg:
description: Simulator build argument (e.g. fixtures URL)
required: false
type: string
enable_buildarg:
description: Enable buildarg flag
required: true
default: false
type: boolean
jobs:
test:
name: Build and run tests
runs-on: ubuntu-latest
steps:
- name: Set up parameters
run: |
echo "TEST_SUITE=${{ github.event.inputs.test-suite || 'ethereum/engine' }}" >> $GITHUB_ENV
echo "LIMIT=${{ github.event.inputs.limit || '' }}" >> $GITHUB_ENV
echo "LOG_LEVEL=${{ github.event.inputs.log-level || '3' }}" >> $GITHUB_ENV
echo "HIVE_REPO=${{ github.event.inputs.hive-repo || 'ethereum/hive' }}" >> $GITHUB_ENV
echo "HIVE_BRANCH=${{ github.event.inputs.hive-branch || 'master' }}" >> $GITHUB_ENV
echo "BUILDARG=${{ github.event.inputs.buildarg || '' }}" >> $GITHUB_ENV
echo "ENABLE_BUILDARG=${{ github.event.inputs.enable_buildarg || false }}" >> $GITHUB_ENV
- name: Check out Nethermind repository
uses: actions/checkout@v4
with:
path: nethermind
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: nethermind
file: nethermind/Dockerfile
tags: nethermind:test-${{ github.sha }}
outputs: type=docker,dest=/tmp/image.tar
- name: Check out Hive repository
uses: actions/checkout@v4
with:
repository: ${{ env.HIVE_REPO }}
ref: ${{ env.HIVE_BRANCH }}
path: hive
- name: Patch Hive Dockerfile
run: sed -i 's#FROM $baseimage:$tag#FROM nethermind:test-${{ github.sha }}#g' hive/clients/nethermind/Dockerfile
- name: Build Hive
working-directory: hive
run: go build .
- name: Load Docker image
run: docker load --input /tmp/image.tar
- name: Run Hive
continue-on-error: true
working-directory: hive
run: |
HIVE_ARGS="--client nethermind --sim $TEST_SUITE --sim.loglevel $LOG_LEVEL"
# Add optional arguments based on conditions
if [ -n "$LIMIT" ]; then
HIVE_ARGS="$HIVE_ARGS --sim.limit $LIMIT"
fi
if [ "$ENABLE_BUILDARG" = "true" ] && [ -n "$BUILDARG" ]; then
HIVE_ARGS="$HIVE_ARGS --sim.buildarg \"$BUILDARG\""
fi
# Execute hive with constructed arguments
eval "./hive $HIVE_ARGS"
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: results-${{ github.run_number }}-${{ github.run_attempt }}
path: hive/workspace
retention-days: 7
- name: Print results
run: |
rm hive/workspace/logs/hive.json # redundant: remove to avoid jq error
chmod +x nethermind/scripts/hive-results.sh
nethermind/scripts/hive-results.sh "hive/workspace/logs/*.json"