-
Notifications
You must be signed in to change notification settings - Fork 88
108 lines (87 loc) · 3.51 KB
/
coverage.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Evmone Coverage Report
on:
pull_request:
paths:
- 'converted-ethereum-tests.txt' # This triggers the workflow only for changes in file.txt
jobs:
print-new-lines:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }} # Checks out the PR branch
fetch-depth: 0 # Necessary to fetch all history for diff
- name: Fetch target branch
run: git fetch origin ${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
- name: Install deps
run: |
echo $(pwd)
sudo apt-get install curl
#install pyspec deps from root repo
python3 --version
python3 -m venv ./venv/
source ./venv/bin/activate
pip install -e .
cd ..
#install go
curl -L --output go1.21.8.linux-amd64.tar.gz "https://go.dev/dl/go1.21.8.linux-amd64.tar.gz"
tar -xf go1.21.8.linux-amd64.tar.gz
sudo mv go /usr/local
sudo ln -s /usr/local/go/bin/go /usr/local/bin/go
git clone --depth 1 https://github.com/ethereum/go-ethereum.git
cd go-ethereum
go build ./cmd/evm
cp evm /usr/local/bin
cd ..
#install solc
curl -L --output solc "https://github.com/ethereum/solidity/releases/download/v0.8.25/solc-static-linux"
sudo mv solc /usr/local/bin
sudo chmod +x /usr/local/bin/solc
solc --version
#install tests
mkdir testpath
cd testpath
git init
git remote add origin https://github.com/ethereum/tests.git
git config core.sparseCheckout true
git sparse-checkout set GeneralStateTests
git pull origin develop
cd ..
#install coverge script
git clone https://github.com/winsvega/evmtest_coverage.git
# This command diffs the file and filters in new lines
- name: Parse converted tests from converted-ethereum-tests.txt
run: |
echo "New lines introduced in converted-ethereum-tests.txt:"
lines=$(git diff origin/${{ github.base_ref }} HEAD -- converted-ethereum-tests.txt | grep "^+" | grep -v "^+++")
files=$(echo "$lines" | grep -oP '(?<=\+).+\.json')
for file in $files; do
echo $file
done
mkdir ../evmtest_coverage/testBASE
for file in $files; do
cp ../testpath/$file ../evmtest_coverage/testBASE
done
# This command diffs the .py scripts introduced by a PR
- name: Parse and fill introduced test sources
run: |
python3 -m venv ./venv/
source ./venv/bin/activate
files=$(git diff --name-status origin/${{ github.base_ref }}...HEAD -- tests/ | grep -E '^[AM]' | grep '\.py$')
echo "Modified or new .py files in tests folder:"
echo "$files" | while read line; do
file=$(echo "$line" | cut -c 3-)
echo $file
done
# fill new tests
echo "$files" | while read line; do
file=$(echo "$line" | cut -c 3-)
fill $file --until=Cancun
done
mkdir ../evmtest_coverage/testPATCH
find ./fixtures -type f -name "*.json" -exec cp {} ../evmtest_coverage/testPATCH \;
- name: Run coverage script
run: |
ls ../evmtest_coverage/testBASE
ls ../evmtest_coverage/testPATCH