-
Notifications
You must be signed in to change notification settings - Fork 7
228 lines (192 loc) · 6.59 KB
/
Copy pathci-test.yaml
File metadata and controls
228 lines (192 loc) · 6.59 KB
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: ci-run-tests
on:
pull_request:
push:
branches: [main]
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-tests:
name: unit-tests 🧪
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup Bun
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
with:
bun-version: '1.3.5'
- name: Install deps
run: bun install
- name: Build
run: bun run build
- name: Run unit tests w/ coverage
run: |
bun test src
test -f coverage/lcov.info || (echo "lcov not found for unit tests" && exit 1)
mv coverage/lcov.info lcov.unit.info
- name: Upload unit coverage
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: lcov-unit
path: lcov.unit.info
e2e-tests:
name: e2e-tests 🔚2️⃣🔚
runs-on: ubuntu-latest
needs: unit-tests
steps:
- name: Checkout repo
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup Bun
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.0.2
with:
bun-version: '1.3.5'
- name: Install deps
run: bun install --frozen-lockfile
- name: Install build deps
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends lcov
- name: Install Foundry (anvil)
uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # v1.6.0
with:
version: v1.5.1
- name: Run ZKsync OS (L1-L2)
uses: dutterbutter/zksync-server-action@1e0262a81dbbadbb535c6acc13cb23e9f2495812
with:
version: v0.18.1
protocol_version: v31.0
setup: multi_chain
l2_ports: |
506: 3052
6565: 3050
6566: 3051
- name: Compile test contracts
working-directory: tests/contracts
run: |
forge build
- name: Run ethers e2e
run: |
bun run test:e2e:ethers
test -f coverage/lcov.info || (echo "lcov not found for e2e ethers" && exit 1)
mv coverage/lcov.info lcov.e2e.ethers.info
- name: Run viem e2e
run: |
bun run test:e2e:viem
test -f coverage/lcov.info || (echo "lcov not found for e2e viem" && exit 1)
mv coverage/lcov.info lcov.e2e.viem.info
- name: Merge E2E LCOV
run: |
lcov -a lcov.e2e.ethers.info -a lcov.e2e.viem.info -o lcov.e2e.info
- name: Upload e2e coverage
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: lcov-e2e
path: lcov.e2e.info
coverage-merge:
name: coverage-merge 📊
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
needs: [unit-tests, e2e-tests]
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: lcov-unit
path: ./cov
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: lcov-e2e
path: ./cov
- name: Install lcov and merge
run: |
sudo apt-get update && sudo apt-get install -y lcov
lcov -a ./cov/lcov.unit.info -a ./cov/lcov.e2e.info -o ./cov/lcov.merged.info
- name: Report coverage on PR
if: ${{ github.event_name == 'pull_request' }}
uses: zgosalvez/github-actions-report-lcov@8ead3c903cefbc389528f5e032e793a5d0e5b626 # v5.0.2
with:
coverage-files: ./cov/lcov.merged.info
minimum-coverage: 80
artifact-name: coverage-html
github-token: ${{ secrets.GITHUB_TOKEN }}
update-comment: true
title-prefix: "ci-run-tests"
- name: Upload merged LCOV
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: lcov-merged
path: ./cov/lcov.merged.info
if-no-files-found: error
retention-days: 7
codecov:
name: codecov ☁️
runs-on: ubuntu-latest
needs: coverage-merge
steps:
- name: Checkout repo
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 2
- name: Download merged LCOV
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: lcov-merged
path: ./cov
- name: Upload to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
files: ./cov/lcov.merged.info
flags: combined
disable_search: true
verbose: true
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
docs-examples:
name: docs-examples 📑
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
suite:
- "docs/snippets/core"
- "docs/snippets/ethers"
- "docs/snippets/viem"
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install build deps
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends lcov
- name: Install Foundry (anvil)
uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # v1.6.0
with:
version: v1.5.1
- name: Run ZKsync OS (L1-L2)
uses: dutterbutter/zksync-server-action@1e0262a81dbbadbb535c6acc13cb23e9f2495812
with:
version: v0.18.1
protocol_version: v31.0
setup: multi_chain
l2_ports: |
506: 3052
6565: 3050
6566: 3051
- name: Setup Bun
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
with:
bun-version: '1.3.5'
- name: Install deps
run: bun install
- name: Build
run: bun run build
- name: Run docs examples tests
env:
L1_RPC: http://localhost:8545
L2_RPC: http://localhost:3050
PRIVATE_KEY: '0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110'
run: |
bun test ${{ matrix.suite }} --timeout 100000