From 2bbea97cbf5021cea6489497b1abb69ae90ab2f6 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 19 Sep 2023 18:46:02 +0800 Subject: [PATCH 1/3] Add basic CI test --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1ee5d30 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: Test + +on: + pull_request: + branches: '*' + push: + branches: + - main + - ci-test + +jobs: + test: + name: Run unit tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + check-latest: true + - name: Set up Gitea access token + env: + TOKEN: ${{ secrets.CICD_REPO_TOKEN }} + run: | + git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf https://git.vdb.to/ + - name: Build tools + run: make dumpdiff.plugeth dumpdiff.geth + - name: Run diff comparison + run: ./scripts/compare-diffs.sh + -- 2.45.2 From c8d12229223a47a89654fee21340506a47a3c38b Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 20 Sep 2023 01:26:26 +0800 Subject: [PATCH 2/3] usage in readme --- README.md | 8 ++++++++ scripts/compare-diffs.sh | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e11594c..60c53bb 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,11 @@ Tooling to directly verify and benchmark the results of go-ethereum state diffs. Specifically, compares `plugeth-statediff`- and `go-ethereum/statediff`-built diffs. + +## Usage + +``` +make dumpdiff.plugeth dumpdiff.geth + +./scripts/compare-diffs.sh +``` diff --git a/scripts/compare-diffs.sh b/scripts/compare-diffs.sh index 601a0e4..da67135 100755 --- a/scripts/compare-diffs.sh +++ b/scripts/compare-diffs.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -ex +set -e PLUGIN_OUTPUT=$(mktemp -d -t plugin_) GETH_OUTPUT=$(mktemp -d -t geth_) @@ -11,4 +11,5 @@ GETH_OUTPUT=$(mktemp -d -t geth_) for file in $(ls $PLUGIN_OUTPUT) do diff "$PLUGIN_OUTPUT/$file" "$GETH_OUTPUT/$file" + echo Files match: "$PLUGIN_OUTPUT/$file" "$GETH_OUTPUT/$file" done -- 2.45.2 From 655607c32d0c9e59397c175c9156652349748d66 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 20 Sep 2023 01:32:37 +0800 Subject: [PATCH 3/3] mktemp linux --- scripts/compare-diffs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/compare-diffs.sh b/scripts/compare-diffs.sh index da67135..5cf9095 100755 --- a/scripts/compare-diffs.sh +++ b/scripts/compare-diffs.sh @@ -2,8 +2,8 @@ set -e -PLUGIN_OUTPUT=$(mktemp -d -t plugin_) -GETH_OUTPUT=$(mktemp -d -t geth_) +PLUGIN_OUTPUT=$(mktemp -d -t plugin_XXXX) +GETH_OUTPUT=$(mktemp -d -t geth_XXXX) ./dumpdiff.plugeth $PLUGIN_OUTPUT ./dumpdiff.geth $GETH_OUTPUT -- 2.45.2