-
Notifications
You must be signed in to change notification settings - Fork 347
136 lines (112 loc) · 3.45 KB
/
l1-deploy-scripts-ci.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
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
name: L1 Deploy Scripts Tests CI
env:
ANVIL_PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
ANVIL_RPC_URL: "http://127.0.0.1:8545"
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: true
- name: Use Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18.18.0
cache: yarn
- name: Install dependencies
run: yarn
- name: Build artifacts
working-directory: ./l1-contracts
run: forge build
- name: Build system-contract artifacts
run: yarn sc build
- name: Create cache
uses: actions/cache/save@v3
with:
key: artifacts-l1-contracts-foundry-${{ github.sha }}
path: |
l1-contracts/cache
l1-contracts/out
system-contracts/artifacts-zk
system-contracts/bootloader/build
system-contracts/cache-zk
system-contracts/contracts-preprocessed
system-contracts/typechain
scripts:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: true
- name: Restore artifacts cache
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
key: artifacts-l1-contracts-foundry-${{ github.sha }}
path: |
l1-contracts/cache
l1-contracts/out
system-contracts/artifacts-zk
system-contracts/bootloader/build
system-contracts/cache-zk
system-contracts/contracts-preprocessed
system-contracts/typechain
- name: Use Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Copy configs from template
working-directory: ./l1-contracts
run: cp -r deploy-script-config-template script-config
- name: Run anvil
run: |
anvil --silent &
ANVIL_READY=0
for i in {1..10}; do
if curl -s -o /dev/null $ANVIL_RPC_URL -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_chainId","id":1}'; then
echo "Anvil is ready"
ANVIL_READY=1
break
else
echo "Waiting for Anvil to become ready..."
sleep 1
fi
done
if [ $ANVIL_READY -ne 1 ]; then
echo "Anvil failed to become ready after 10 attempts."
exit 1
fi
test-ffi:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Use Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.18.0
cache: yarn
- name: Install dependencies
run: yarn
- name: Restore artifacts cache
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
key: artifacts-l1-${{ github.sha }}
path: |
l1-contracts/artifacts
l1-contracts/cache
l1-contracts/typechain
- name: Run tests
run: yarn l1 test:ffi