Skip to content

Commit

Permalink
ci: Add Silkworm-driven consensus tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Feb 19, 2021
1 parent e2f2c87 commit 0bcafb7
Showing 1 changed file with 88 additions and 12 deletions.
100 changes: 88 additions & 12 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,62 @@ executors:
xcode: 11.1.0

commands:
build_silkworm:
steps:
- restore_cache:
name: "Restore Silkworm cache"
key: &silkworm-cache-key silkworm-v1
- run:
name: "Check Silkworm cache"
command: |
if [ -f ~/silkworm/consensus ]; then
echo 'Cached Silkworm binary available - skip build.'
else
echo 'export SILKWORM_BUILD=true' >> $BASH_ENV
fi
- run:
name: "Install GMP-dev"
command: |
[ "$SILKWORM_BUILD" = true ] || exit 0
sudo apt-get -q update && sudo apt-get -qy install --no-install-recommends libgmp-dev
- run:
name: "Checkout Silkworm"
working_directory: ~/silkworm/src
command: |
[ "$SILKWORM_BUILD" = true ] || exit 0
git clone --no-checkout --single-branch https://github.com/torquem-ch/silkworm.git .
git checkout 614fabfcf19b8e06f0dcbe3e9af2345dcf748f3e
git submodule init
git submodule deinit tests
git submodule update --recursive --depth=1 --progress
- run:
name: "Configure Silkworm"
working_directory: ~/silkworm
command: |
[ "$SILKWORM_BUILD" = true ] || exit 0
cmake -S src -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$(pwd)
- run:
name: "Build Silkworm cmd/consensus"
working_directory: ~/silkworm
command: |
[ "$SILKWORM_BUILD" = true ] || exit 0
cmake --build build --parallel --target consensus
- save_cache:
name: "Save Silkworm cache"
key: *silkworm-cache-key
paths:
- ~/silkworm/consensus

download_consensus_tests:
parameters:
rev:
type: string
steps:
- run:
name: "Download consensus tests: <<parameters.rev>>"
working_directory: ~/tests
command: curl -L https://github.com/ethereum/tests/archive/<<parameters.rev>>.tar.gz | tar -xz --strip=1

build:
description: "Build"
steps:
Expand Down Expand Up @@ -115,6 +171,15 @@ commands:
paths:
- evmone-*

unpack_package:
steps:
- attach_workspace:
at: ~/package
- run:
name: "Unpack evmone"
working_directory: ~/package
command: tar xz < evmone*.tar.gz

jobs:

lint:
Expand Down Expand Up @@ -173,33 +238,41 @@ jobs:
echo $name
ghr -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -n "$name" $prerelease_flag $CIRCLE_TAG ~/package
consensus-tests:
environment:
TESTS_REV: v7.0.0
executor: linux-gcc-latest
steps:
- build_silkworm
- unpack_package
- download_consensus_tests:
rev: v7.0.0
- run:
name: "Silkworm-driven consensus tests"
command: ~/silkworm/consensus --evm ~/package/lib/libevmone.so --tests ~/tests

state-tests:
environment:
TESTS_REV: ac8cf2cd8ba326d67101183060272e7f7b1eaa92
ALETH_REV: 1.8.0
docker:
- image: cimg/base:stable
steps:
- attach_workspace:
at: ~/package
- run:
name: "Unpack evmone"
background: true
command: tar xz < ~/package/evmone*.tar.gz
- unpack_package
- run:
name: "Download Aleth"
background: true
command: curl -L https://github.com/ethereum/aleth/releases/download/v$ALETH_REV/aleth-$ALETH_REV-linux-x86_64.tar.gz | tar xz
- download_consensus_tests:
rev: ac8cf2cd8ba326d67101183060272e7f7b1eaa92
- run:
name: "Download tests"
name: "Fixup consensus tests"
command: |
mkdir tests && cd tests
curl -L https://github.com/ethereum/tests/archive/$TESTS_REV.tar.gz | tar -xz --strip=1
mkdir GeneralStateTests/stEWASMTests
mkdir src/GeneralStateTestsFiller/stEWASMTests
mkdir -p ~/tests/GeneralStateTests/stEWASMTests
mkdir -p ~/tests/src/GeneralStateTestsFiller/stEWASMTests
- run:
name: "Run State Tests"
command: bin/testeth -t GeneralStateTests -- --testpath tests --vm lib/libevmone.so
command: bin/testeth -t GeneralStateTests -- --testpath ~/tests --vm ~/package/lib/libevmone.so


gcc-min:
Expand Down Expand Up @@ -306,6 +379,9 @@ workflows:
ignore: /.*/
tags:
only: /^v[0-9].*/
- consensus-tests:
requires:
- release-linux
- state-tests:
requires:
- release-linux
Expand Down

0 comments on commit 0bcafb7

Please sign in to comment.