forked from paradigmxyz/reth
-
Notifications
You must be signed in to change notification settings - Fork 1
191 lines (161 loc) · 5.86 KB
/
kurtosis-op.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
# Runs simple OP stack setup in Kurtosis
name: kurtosis-op
on:
workflow_dispatch:
inputs:
op-node-repo:
type: string
required: true
default: https://github.com/ethereum-optimism/optimism.git
op-node-ref:
type: string
required: true
default: develop
op-geth-repo:
type: string
required: true
default: https://github.com/ethereum-optimism/op-geth.git
op-geth-ref:
type: string
required: true
default: optimism
env:
CARGO_TERM_COLOR: always
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
prepare-op-node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare artifacts directory
run: mkdir ./artifacts
- name: Checkout ${{ inputs.op-node-repo }}@${{ inputs.op-node-ref || 'HEAD' }}
run: |
mkdir -p ./lib/op-node
git clone ${{ inputs.op-node-repo }} ./lib/op-node
cd ./lib/op-node
git checkout ${{ inputs.op-node-ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build op-node image
uses: docker/build-push-action@v6
with:
context: ./lib/op-node
file: ./lib/op-node/ops/docker/op-stack-go/Dockerfile
target: op-node-target
tags: ghcr.io/ethereum-optimism/op-node:kurtosis-ci
outputs: type=docker,dest=./artifacts/op_node_image.tar
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Upload op-node image
id: upload
uses: actions/upload-artifact@v4
with:
name: artifacts--op-node
path: ./artifacts/op_node_image.tar
prepare-op-geth:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Prepare artifacts directory
run: mkdir ./artifacts
- name: Checkout ${{ inputs.op-geth-repo }}@${{ inputs.op-geth-ref || 'HEAD' }}
run: |
mkdir -p ./lib/op-geth
git clone ${{ inputs.op-geth-repo }} ./lib/op-geth
cd ./lib/op-geth
git checkout ${{ inputs.op-geth-ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build op-geth image
uses: docker/build-push-action@v6
with:
context: ./lib/op-geth
file: ./lib/op-geth/Dockerfile
tags: ghcr.io/ethereum-optimism/op-geth:kurtosis-ci
outputs: type=docker,dest=./artifacts/op_geth_image.tar
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Upload op-geth images
id: upload
uses: actions/upload-artifact@v4
with:
name: artifacts--op-geth
path: ./artifacts/op_geth_image.tar
prepare-reth:
uses: ./.github/workflows/prepare-reth.yml
with:
image_tag: ghcr.io/paradigmxyz/op-reth:kurtosis-ci
binary_name: op-reth
cargo_features: optimism,asm-keccak
cargo_package: crates/optimism/bin/Cargo.toml
test:
timeout-minutes: 60
strategy:
fail-fast: false
name: run kurtosis
runs-on: ubuntu-latest
needs:
- prepare-reth
- prepare-op-geth
- prepare-op-node
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download reth image
uses: actions/download-artifact@v4
with:
pattern: artifacts--*
merge-multiple: true
path: /tmp
- name: Load Docker image
run: |
# Load all images from artifacts
docker load -i /tmp/reth_image.tar
docker load -i /tmp/op_geth_image.tar
docker load -i /tmp/op_node_image.tar
# List available images
docker image ls -a
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Run kurtosis
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
kurtosis engine start
kurtosis run --enclave op-devnet github.com/ethpandaops/optimism-package --args-file .github/assets/kurtosis_op_network_params.yaml
ENCLAVE_ID=$(curl http://127.0.0.1:9779/api/enclaves | jq --raw-output 'keys[0]')
GETH_PORT=$(curl "http://127.0.0.1:9779/api/enclaves/$ENCLAVE_ID/services" | jq '."op-el-1-op-geth-op-node-op-kurtosis".public_ports.rpc.number')
RETH_PORT=$(curl "http://127.0.0.1:9779/api/enclaves/$ENCLAVE_ID/services" | jq '."op-el-2-op-reth-op-node-op-kurtosis".public_ports.rpc.number')
echo "GETH_RPC=http://127.0.0.1:$GETH_PORT" >> $GITHUB_ENV
echo "RETH_RPC=http://127.0.0.1:$RETH_PORT" >> $GITHUB_ENV
- name: Assert that clients advance
run: |
for i in {1..100}; do
sleep 5
BLOCK_GETH=$(cast bn --rpc-url $GETH_RPC)
BLOCK_RETH=$(cast bn --rpc-url $RETH_RPC)
if [ $BLOCK_GETH -ge 100 ] && [ $BLOCK_RETH -ge 100 ] ; then exit 0; fi
echo "Waiting for clients to advance..., Reth: $BLOCK_RETH Geth: $BLOCK_GETH"
done
kurtosis service logs -a op-devnet op-el-2-op-reth-op-node-op-kurtosis
kurtosis service logs -a op-devnet op-cl-2-op-node-op-reth-op-kurtosis
exit 1
notify-on-error:
needs: test
if: failure()
runs-on: ubuntu-latest
steps:
- name: Slack Webhook Action
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "Failed run: https://github.com/paradigmxyz/reth/actions/runs/${{ github.run_id }}"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}