forked from erigontech/erigon
-
Notifications
You must be signed in to change notification settings - Fork 41
207 lines (179 loc) · 6.94 KB
/
ci_zkevm.yml
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: CI
on:
push:
branches:
- zkevm
- zkevm-2.60
pull_request:
branches:
- zkevm
- zkevm-2.60
- stable*
types:
- opened
- reopened
- synchronize
- ready_for_review
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
jobs:
tests:
strategy:
max-parallel: 2
fail-fast: true
matrix:
os: [ ubuntu-22.04, macos-14-xlarge ] # list of os: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ matrix.os == 'macos-14-xlarge' && 40 || 30 }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
- name: Build
run: make BUILD_TAGS=nosqlite,noboltdb,nosilkworm cdk-erigon
- name: Reproducible build test
run: |
make cdk-erigon
shasum -a256 ./build/bin/cdk-erigon > erigon1.sha256
make cdk-erigon
shasum -a256 ./build/bin/cdk-erigon > erigon2.sha256
if ! cmp -s erigon1.sha256 erigon2.sha256; then
echo >&2 "Reproducible build broken"; cat erigon1.sha256; cat erigon2.sha256; exit 1
fi
# - name: Lint
# if: runner.os == 'Linux'
# uses: golangci/golangci-lint-action@v4
# with:
# version: v1.54
- name: Test
run: make test
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
if: ${{ matrix.os == 'ubuntu-20.04' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
kurtosis-cdk:
runs-on: ubuntu-latest
strategy:
matrix:
da-mode: [ "rollup", "cdk-validium" ]
steps:
- name: Checkout cdk-erigon
uses: actions/checkout@v4
- name: Setup kurtosis
uses: ./.github/actions/setup-kurtosis
- name: Run process with CPU monitoring
working-directory: ./cdk-erigon
run: |
# Start monitoring in background
bash ./.github/scripts/cpu_monitor.sh &
monitor_pid=$!
# Wait for 30 seconds
sleep 30
# Stop monitoring and get analysis
kill -TERM $monitor_pid
wait $monitor_pid || {
echo "CPU usage exceeded threshold!"
exit 1
}
- name: Monitor verified batches
working-directory: ./kurtosis-cdk
shell: bash
run: timeout 900s .github/scripts/monitor-verified-batches.sh --enclave zdk-v1 --rpc-url $(kurtosis port print cdk-v1 cdk-erigon-rpc-001 rpc) --target 20 --timeout 900
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up envs
run: |
kurtosis files download cdk-v1 bridge-config-artifact
echo "BRIDGE_ADDRESS=$(/usr/local/bin/yq '.NetworkConfig.PolygonBridgeAddress' bridge-config-artifact/bridge-config.toml)" >> $GITHUB_ENV
echo "ETH_RPC_URL=$(kurtosis port print cdk-v1 el-1-geth-lighthouse rpc)" >> $GITHUB_ENV
echo "BRIDGE_API_URL=$(kurtosis port print cdk-v1 zkevm-bridge-service-001 rpc)" >> $GITHUB_ENV
echo "L2_RPC_URL=$(kurtosis port print cdk-v1 cdk-erigon-rpc-001 rpc)" >> $GITHUB_ENV
- name: Clone bridge repository
run: git clone --recurse-submodules -j8 https://github.com/0xPolygonHermez/zkevm-bridge-service.git -b develop bridge
- name: Build docker image
run: |
cd bridge
make build-docker-e2e-real_network
- name: Run test ERC20 Bridge
run: |
#!/bin/bash
cd bridge
mkdir tmp
cat <<EOF > ./tmp/test.toml
TestL1AddrPrivate="0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"
TestL2AddrPrivate="0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"
[ConnectionConfig]
L1NodeURL="http://${ETH_RPC_URL}"
L2NodeURL="${L2_RPC_URL}"
BridgeURL="${BRIDGE_API_URL}"
L1BridgeAddr="${BRIDGE_ADDRESS}"
L2BridgeAddr="${BRIDGE_ADDRESS}"
EOF
docker run --network=host --volume "./tmp/:/config/" --env BRIDGE_TEST_CONFIG_FILE=/config/test.toml bridge-e2e-realnetwork-erc20
- name: Upload logs
uses: actions/upload-artifact@v3
with:
name: evm-rpc-tests-logs-${{ github.run_id }}
path: ./cdk-erigon/logs/evm-rpc-tests.log
- name: Prepare logs
working-directory: ./kurtosis-cdk
if: failure()
run: |
mkdir -p ci_logs
cd ci_logs
kurtosis service logs cdk-v1 cdk-erigon-rpc-001 --all > cdk-erigon-rpc-001.log
kurtosis service logs cdk-v1 cdk-erigon-sequencer-001 --all > cdk-erigon-sequencer-001.log
kurtosis service logs cdk-v1 zkevm-agglayer-001 --all > zkevm-agglayer-001.log
kurtosis service logs cdk-v1 zkevm-prover-001 --all > zkevm-prover-001.log
kurtosis service logs cdk-v1 cdk-node-001 --all > cdk-node-001.log
kurtosis service logs cdk-v1 zkevm-bridge-service-001 --all > zkevm-bridge-service-001.log
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: logs_${{ github.run_id }}
path: ./kurtosis-cdk/ci_logs
kurtosis-cdk-post-london:
runs-on: ubuntu-latest
steps:
- name: Checkout cdk-erigon
uses: actions/checkout@v4
with:
path: cdk-erigon
- name: Checkout kurtosis-cdk
uses: actions/checkout@v4
- name: Setup kurtosis
uses: ./.github/actions/setup-kurtosis
- name: Dynamic gas fee tx load test
working-directory: ./kurtosis-cdk
run: /usr/local/bin/polycli loadtest --rpc-url "$(kurtosis port print cdk-v1 cdk-erigon-rpc-001 rpc)" --private-key "0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625" --verbosity 700 --requests 500 --rate-limit 50 --mode uniswapv3 --legacy
- name: Upload logs
uses: actions/upload-artifact@v3
with:
name: evm-rpc-tests-logs-${{ github.run_id }}
path: ./cdk-erigon/logs/evm-rpc-tests.log
- name: Prepare logs
working-directory: ./kurtosis-cdk
if: failure()
run: |
mkdir -p ci_logs
cd ci_logs
kurtosis service logs cdk-v1 cdk-erigon-rpc-001 --all > cdk-erigon-rpc-001.log
kurtosis service logs cdk-v1 cdk-erigon-sequencer-001 --all > cdk-erigon-sequencer-001.log
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: logs_${{ github.run_id }}
path: ./kurtosis-cdk/ci_logs