-
Notifications
You must be signed in to change notification settings - Fork 177
199 lines (165 loc) · 5.39 KB
/
build-test.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
name: Build, Test
on:
pull_request:
workflow_dispatch:
env:
MAINNET_RPC: ${{ secrets.MAINNET_RPC }}
jobs:
install:
name: Install on Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
lint:
name: Lint on Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
needs: install
permissions:
checks: write # https://github.com/mikepenz/action-junit-report/issues/23#issuecomment-1412597753
env:
TEST_PATH: /tmp/test-results
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
- name: Lint sdk
run: |
yarn gen:abi
yarn build --reporter-options output=$TEST_PATH/sdk.xml
yarn lint --format junit -o $TEST_PATH/sdk-lint.xml
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: lint-results
path: ${{ env.TEST_PATH }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: '${{ env.TEST_PATH }}/sdk-lint.xml'
fail_on_failure: false
# TODO: need to fix codecov, hasn't been working for a while according to #172 comment
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
verbose: false
audit:
name: Audit on Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
needs: install
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
- run: yarn audit:ci
test-unit:
name: Test (Unit) on Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
needs: install
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
- name: Build
run: |
yarn gen:abi
yarn build
- name: Run unit tests
run: CI=true yarn test:unit
test-integration:
name: Test (Integration) on Node.js v${{ matrix.node-version }}${{ matrix.orbit-test == '1' && ' with L3' || '' }}${{ matrix.decimals == '16' && ' with custom gas token (16 decimals)' || matrix.decimals == '20' && ' with custom gas token (20 decimals)' || matrix.decimals == '18' && ' with custom gas token (18 decimals)' || '' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false # runs all tests to completion even if one fails
matrix:
include:
- orbit-test: '0'
node-version: 18
- orbit-test: '0'
node-version: 20
- orbit-test: '1'
node-version: 18
- orbit-test: '1'
node-version: 20
- orbit-test: '1'
decimals: 16
node-version: 18
- orbit-test: '1'
decimals: 16
node-version: 20
- orbit-test: '1'
decimals: 18
node-version: 18
- orbit-test: '1'
decimals: 18
node-version: 20
- orbit-test: '1'
decimals: 20
node-version: 18
- orbit-test: '1'
decimals: 20
node-version: 20
needs: install
env:
ORBIT_TEST: ${{ matrix.orbit-test }}
DECIMALS: ${{ matrix.decimals || '18' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
- name: Set up the local node
uses: OffchainLabs/actions/run-nitro-test-node@main
with:
nitro-testnode-ref: adapt-bridge-amount
l3-node: ${{ matrix.orbit-test == '1' }}
args: ${{ matrix.decimals == 16 && '--l3-fee-token --l3-fee-token-decimals 16' || matrix.decimals == 20 && '--l3-fee-token --l3-fee-token-decimals 20' || matrix.decimals == 18 && '--l3-fee-token' || '' }}
- name: Copy .env
run: cp ./.env-sample ./.env
- name: Build
run: |
yarn gen:abi
yarn build
- name: Generate network file
run: yarn gen:network
- name: Run integration tests
run: CI=true yarn test:integration