Skip to content

Commit

Permalink
Merge pull request #302 from marioevz/tox-build-development-fork
Browse files Browse the repository at this point in the history
feature: Run development fork tests on github actions
  • Loading branch information
marioevz authored Sep 21, 2023
2 parents 59c0cb4 + 2d60d5d commit a910149
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 23 deletions.
38 changes: 38 additions & 0 deletions .github/actions/build-evm/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'Build EVM'
description: 'Resolves and builds the requested EVM binary by name'
inputs:
type:
description: 'Type of EVM binary to build'
required: true
default: 'main'
outputs:
impl:
description: "Implementation of EVM binary to build"
value: ${{ steps.evm-config-reader.outputs.impl }}
repo:
description: "Repository to use to build the EVM binary"
value: ${{ steps.evm-config-reader.outputs.repo }}
ref:
description: "Reference to branch, commit, or tag to use to build the EVM binary"
value: ${{ steps.evm-config-reader.outputs.ref }}
runs:
using: "composite"
steps:
- name: Get the selected EVM version from the evm-config.yaml
id: evm-config-reader
shell: bash
run: |
awk "/^${{ inputs.type }}:/{flag=1; next} /^[[:alnum:]]/{flag=0} flag" ./evm-config.yaml \
| sed 's/ //g' | sed 's/:/=/g' >> "$GITHUB_OUTPUT"
- name: Print Variables for the selected EVM type
shell: bash
run: |
echo "Implementation: ${{ steps.evm-config-reader.outputs.impl }}"
echo "Repository: ${{ steps.evm-config-reader.outputs.repo }}"
echo "Reference: ${{ steps.evm-config-reader.outputs.ref }}"
- name: Build the EVM using Geth action
if: steps.evm-config-reader.outputs.impl == 'geth'
uses: ./.github/actions/build-geth-evm
with:
repo: ${{ steps.evm-config-reader.outputs.repo }}
ref: ${{ steps.evm-config-reader.outputs.ref }}
36 changes: 36 additions & 0 deletions .github/actions/build-geth-evm/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Build Go-Ethereum EVM'
description: 'Builds the Go-Ethereum EVM binary'
inputs:
repo:
description: 'Source repository to use to build the EVM binary'
required: true
default: 'ethereum/go-ethereum'
ref:
description: 'Reference to branch, commit, or tag to use to build the EVM binary'
required: true
default: 'master'
golang:
description: 'Golang version to use to build Geth'
required: false
default: '1.20.5'
runs:
using: "composite"
steps:
- name: Checkout go-ethereum
uses: actions/checkout@v3
with:
repository: ${{ inputs.repo }}
ref: ${{ inputs.ref }}
path: go-ethereum
- name: Setup golang
uses: actions/setup-go@v4
with:
go-version: ${{ inputs.golang }}
cache-dependency-path: go-ethereum/go.sum
- name: Build evm cmd
shell: bash
run: |
mkdir -p $GITHUB_WORKSPACE/bin
cd $GITHUB_WORKSPACE/go-ethereum/cmd/evm
go build .
echo $GITHUB_WORKSPACE/go-ethereum/cmd/evm >> $GITHUB_PATH
36 changes: 16 additions & 20 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,32 @@ jobs:
include:
- os: ubuntu-latest
python: '3.10'
golang: '1.20.5'
solc: '0.8.20'
evm-type: 'main'
tox-cmd: 'tox'
- os: ubuntu-latest
python: '3.11'
golang: '1.20.5'
solc: '0.8.21'
evm-type: 'main'
tox-cmd: 'tox'
- os: ubuntu-latest
python: '3.11'
solc: '0.8.21'
evm-type: 'develop'
tox-cmd: 'tox -e tests-develop'
- os: macos-latest
python: '3.11'
golang: '1.20.5'
solc: '0.8.21'
evm-type: 'main'
tox-cmd: 'tox'
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Checkout go-ethereum
uses: actions/checkout@v3
- uses: ./.github/actions/build-evm
id: evm-builder
with:
repository: ethereum/go-ethereum
path: go-ethereum
- name: Setup golang
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.golang }}
cache-dependency-path: go-ethereum/go.sum
- name: Build evm cmd
run: |
mkdir -p $GITHUB_WORKSPACE/bin
cd $GITHUB_WORKSPACE/go-ethereum/cmd/evm
go build .
echo $GITHUB_WORKSPACE/go-ethereum/cmd/evm >> $GITHUB_PATH
type: ${{ matrix.evm-type }}
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand All @@ -54,7 +50,7 @@ jobs:
- name: Setup Tools/Dependencies Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt-get install aspell aspell-en
sudo apt-get update && sudo apt-get install -y aspell aspell-en
- name: Setup Tools/Dependencies macOS
if: runner.os == 'macOS'
run: |
Expand All @@ -64,7 +60,7 @@ jobs:
- name: Install Tox and any other packages
run: pip install tox
- name: Run Tox (CPython)
run: tox
run: ${{ matrix.tox-cmd }}
- uses: DavidAnson/markdownlint-cli2-action@v11
with:
globs: |
Expand Down
8 changes: 8 additions & 0 deletions evm-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
main:
impl: geth
repo: ethereum/go-ethereum
ref: master
develop:
impl: geth
repo: marioevz/go-ethereum
ref: cancun-t8n
25 changes: 22 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ env_list =
tests
docs

[main]
development_fork = Cancun

[testenv:framework]
description = Run checks on helper libraries and test framework

Expand All @@ -28,9 +31,7 @@ extras = {[testenv:framework]extras}
allowlist_externals = {[testenv:framework]allowlist_externals}
commands = {[testenv:framework]commands}

[testenv:tests]
description = Run checks on the test cases in tests/

[testenv:tests-base]
extras =
test
lint
Expand All @@ -41,8 +42,26 @@ commands =
black tests --check --diff
flake8 tests
mypy tests

[testenv:tests]
description = Execute test cases in tests/

extras =
{[testenv:tests-base]extras}

commands =
{[testenv:tests-base]commands}
pytest -n auto

[testenv:tests-develop]
description = Execute test cases in tests/, including tests for development forks

extras =
{[testenv:tests-base]extras}

commands =
pytest -n auto --until={[main]development_fork}

[testenv:docs]
description = Run documentation checks

Expand Down

0 comments on commit a910149

Please sign in to comment.