Skip to content

Commit eee1625

Browse files
authored
fix(github): support coverage script for EOF tests (#615)
1 parent 4c3353c commit eee1625

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

.github/workflows/coverage.yaml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ jobs:
1111
steps:
1212
- name: Checkout code
1313
uses: actions/checkout@v3
14-
with:
15-
ref: ${{ github.event.pull_request.head.ref }} # Checks out the PR branch
16-
fetch-depth: 0 # Necessary to fetch all history for diff
1714

1815
- name: Fetch target branch
1916
run: git fetch origin ${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
@@ -23,17 +20,21 @@ jobs:
2320
echo $(pwd)
2421
echo ${{ github.workspace }}
2522
23+
#install solc for `pip install -e .` command
24+
curl -L --output solc "https://github.com/ethereum/solidity/releases/download/v0.8.25/solc-static-linux"
25+
sudo mv solc /usr/local/bin
26+
sudo chmod +x /usr/local/bin/solc
27+
solc --version
28+
2629
#install pyspec deps from root repo
2730
python3 --version
2831
python3 -m venv ./venv/
2932
source ./venv/bin/activate
3033
pip install -e .
3134
32-
#install solc
33-
curl -L --output solc "https://github.com/ethereum/solidity/releases/download/v0.8.25/solc-static-linux"
34-
sudo mv solc /usr/local/bin
35-
sudo chmod +x /usr/local/bin/solc
36-
solc --version
35+
# fix pyspec dependecy
36+
pip3 install solc-select
37+
solc-select use 0.8.25 --always-install
3738
3839
# Required to fill .py tests
3940
- name: Build GO EVM
@@ -55,7 +56,7 @@ jobs:
5556
path: testpath
5657
sparse-checkout: |
5758
GeneralStateTests
58-
59+
EOFTests
5960
6061
# This command diffs the file and filters in new lines
6162
- name: Parse converted tests from converted-ethereum-tests.txt
@@ -85,27 +86,38 @@ jobs:
8586
python3 -m venv ./venv/
8687
source ./venv/bin/activate
8788
88-
files=$(git diff --name-status origin/${{ github.base_ref }}...HEAD -- tests/ | grep -E '^[AM]' | grep '\.py$')
89+
# Fetch the base branch and the head branch
90+
git fetch origin ${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
91+
git fetch origin ${{ github.head_ref }}:refs/remotes/origin/${{ github.head_ref }}
92+
93+
# Perform the diff
94+
files=$(git diff --name-status origin/${{ github.base_ref }}...origin/${{ github.head_ref }} -- tests/ | grep -E '^[AM]' | grep '\.py$')
95+
8996
echo "Modified or new .py files in tests folder:"
9097
echo "$files" | while read line; do
9198
file=$(echo "$line" | cut -c 3-)
9299
echo $file
93100
done
94101
95102
# fill new tests
103+
mkdir -p fixtures/state_tests
104+
mkdir -p fixtures/eof_tests
96105
echo "$files" | while read line; do
97106
file=$(echo "$line" | cut -c 3-)
98-
fill $file --until=Cancun --evm-bin evmone-t8n
107+
fill $file --until=Cancun --evm-bin evmone-t8n || true
108+
fill $file --fork=CancunEIP7692 --evm-bin evmone-t8n || true
99109
done
100110
101-
files=$(find fixtures/state_tests -type f -name "*.json")
102-
if [ -z "$files" ]; then
103-
echo "Error: No filled JSON fixtures found in fixtures/state_tests."
111+
filesState=$(find fixtures/state_tests -type f -name "*.json")
112+
filesEOF=$(find fixtures/eof_tests -type f -name "*.json")
113+
if [ -z "$filesState" || -z "$filesEOF" ]; then
114+
echo "Error: No filled JSON fixtures found in fixtures."
104115
exit 1
105116
fi
106117
107118
mkdir -p ${{ github.workspace }}/evmtest_coverage/coverage/PATCH_TESTS
108119
find fixtures/state_tests -type f -name "*.json" -exec cp {} ${{ github.workspace }}/evmtest_coverage/coverage/PATCH_TESTS \;
120+
find fixtures/eof_tests -type f -name "*.json" -exec cp {} ${{ github.workspace }}/evmtest_coverage/coverage/PATCH_TESTS \;
109121
110122
- name: Print tests that will be covered
111123
run: |

0 commit comments

Comments
 (0)