-
Notifications
You must be signed in to change notification settings - Fork 21
162 lines (132 loc) · 4.25 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
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
run: 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: run tests
run: 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
run: 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
run: 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 }}
- name: merge coverage reports
run: yarn merge-coverage
- name: upload merged coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true