-
Notifications
You must be signed in to change notification settings - Fork 21
180 lines (150 loc) · 4.88 KB
/
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
name: Tests
on:
push:
paths-ignore:
- '**/README.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pkg-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: [
bodhi,
eth-providers,
eth-rpc-adapter,
eth-transactions,
]
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: setup yarn
run: npm install -g yarn
- name: install deps
run: yarn install --immutable
- name: start test infra
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
command: docker compose up -d
- name: start rpc adapter for eth-providers
if: matrix.project == 'eth-providers'
run: yarn workspace @acala-network/eth-rpc-adapter run start:coverage
- name: generate typechain for eth-rpc-adapter tests
if: matrix.project == 'eth-rpc-adapter'
run: yarn workspace @acala-network/eth-rpc-adapter run typegen
- name: run tests
uses: nick-fields/retry@v2
with:
timeout_minutes: 15
max_attempts: 2
command: yarn workspace @acala-network/${{ matrix.project }} run test:coverage
- name: save coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.project }}
path: packages/${{ matrix.project }}/coverage
if-no-files-found: error
include-hidden-files: true
- name: dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
e2e-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: [
e2e-hardhat,
e2e-truffle,
e2e-viem,
]
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: setup yarn
run: npm install -g yarn
- name: install deps
run: yarn install --immutable
- name: start test infra
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
command: docker compose up -d
- name: start coverage server
env:
COVERAGE_DIR: eth-rpc-adapter/coverage-${{ matrix.project }}
run: yarn workspace @acala-network/eth-rpc-adapter run start:coverage
- name: install deps for e2e tests
run: cd e2e-tests/${{ matrix.project }} && yarn install --immutable
- name: run e2e tests
uses: nick-fields/retry@v2
with:
timeout_minutes: 15
max_attempts: 2
command: cd e2e-tests/${{ matrix.project }} && yarn test:acalaFork
- name: stop coverage server and generate coverage report
run: yarn workspace @acala-network/eth-rpc-adapter run stop:coverage
- name: save coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.project }}
path: packages/eth-rpc-adapter/coverage-${{ matrix.project }}
if-no-files-found: error
include-hidden-files: true
- name: dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
merge-and-upload-coverage-reports:
runs-on: ubuntu-latest
needs: [pkg-tests, e2e-tests]
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: setup yarn
run: npm install -g yarn
- name: install deps
run: yarn install --immutable
- name: download all coverage reports
run: |
pkg_tasks="bodhi eth-providers eth-rpc-adapter eth-transactions"
e2e_tasks="e2e-hardhat e2e-truffle e2e-viem"
for pkg in $pkg_tasks; do
echo "downloading coverage for $pkg ..."
mkdir -p packages/$pkg/coverage
gh run download -n coverage-$pkg -D packages/$pkg/coverage
done
for e2e in $e2e_tasks; do
echo "downloading coverage for $e2e ..."
mkdir -p packages/eth-rpc-adapter/coverage-$e2e
gh run download -n coverage-$e2e -D packages/eth-rpc-adapter/coverage-$e2e
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# does not need to merge, as upload action will auto upload all and merge
- name: upload all coverage report and auto merge
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true