-
Notifications
You must be signed in to change notification settings - Fork 111
285 lines (243 loc) · 8.4 KB
/
Copy pathtests.yml
File metadata and controls
285 lines (243 loc) · 8.4 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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
name: Tests
on:
push:
branches: [ main, feature/evm-network-driver, feature/zkat-snark-driver ]
pull_request:
branches: [ main, feature/evm-network-driver, feature/zkat-snark-driver ]
workflow_dispatch:
inputs:
fsc-version:
default: 'github.com/hyperledger-labs/fabric-smart-client@main'
required: true
description: 'FSC dependency'
env:
GOFLAGS: -mod=mod
permissions:
contents: read
jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
- name: Replace FSC dep
run: |
if [ -n "${{ github.event.inputs.fsc-version }}" ]; then
echo "Replace FSC dependency"
go mod edit -replace=github.com/hyperledger-labs/fabric-smart-client=${{ github.event.inputs.fsc-version }}
go mod tidy || true
else
echo "Skipping FSC dependency replacement"
fi
- name: Set up tools
run: make install-tools
- name: Run checks
run: make checks
- name: Run linter
run: make lint
utest:
needs: checks
runs-on: ubuntu-latest
strategy:
matrix:
tests: [unit-tests-race, unit-tests-regression]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
- name: Set up tools
run: make install-tools
- name: Install Testing Docker Images
run: make testing-docker-images
- name: Unit Tests with Coverage
run: |
make unit-tests
./ci/scripts/filter-coverage.sh profile.cov profile.cov
- name: Send coverage to Coveralls
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: profile.cov
flag-name: utest-${{ matrix.tests }}
parallel: true
fail-on-error: false
- name: Run ${{ matrix.tests }}
run: make ${{ matrix.tests }}
itest:
needs: checks
if: github.ref == 'refs/heads/main' || github.base_ref == 'main'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# NOTE: the fungible suites loop over integration.AllTestTypes, so a plain
# "TN" label filter runs that spec once per infrastructure type
# (websocket, libp2p, replicas) sequentially in a single job. The specs
# calling fungible.TestAll are expensive enough that this tripled the job
# runtime (~45m), so they are split into one job per infrastructure type
# here. Coverage is unchanged: all three configurations still run, just in
# parallel. See fungible.mk / fabricx.mk for the matching targets.
tests: [
dlog-fabric-t1-websocket,
dlog-fabric-t1-libp2p,
dlog-fabric-t1-replicas,
dlog-fabric-t2,
dlog-fabric-t2.1,
dlog-fabric-t3,
dlog-fabric-t4,
dlog-fabric-t5,
dlog-fabric-t6-websocket,
dlog-fabric-t6-libp2p,
dlog-fabric-t6-replicas,
dlog-fabric-t7,
dlog-fabric-t8-websocket,
dlog-fabric-t8-libp2p,
dlog-fabric-t8-replicas,
dlog-fabric-t9,
dlog-fabric-t10-websocket,
dlog-fabric-t10-libp2p,
dlog-fabric-t10-replicas,
dlog-fabric-t11,
dlog-fabric-t12,
dlog-fabric-t13,
# dlog-fabric-t14,
fabricx-dlog-t1-websocket,
fabricx-dlog-t1-libp2p,
fabricx-dlog-t1-replicas,
# fabricx-dlog-t2,
# fabricx-dlog-t2.1,
fabricx-dlog-t3,
fabricx-dlog-t4,
fabricx-dlog-t5,
fabricx-dlog-t6-websocket,
fabricx-dlog-t6-libp2p,
fabricx-dlog-t6-replicas,
# fabricx-dlog-t7,
# fabricx-dlog-t9,
fabricx-dlog-t11,
# fabricx-dlog-t12,
fabricx-dlog-t13,
# fabricx-dlog-t14,
fabricx-dlog-t16-websocket,
fabricx-dlog-t16-libp2p,
fabricx-dlog-t16-replicas,
fabtoken-dlog-fabric,
dloghsm-fabric-t1-websocket,
dloghsm-fabric-t1-libp2p,
dloghsm-fabric-t1-replicas,
dloghsm-fabric-t2-websocket,
dloghsm-fabric-t2-libp2p,
dloghsm-fabric-t2-replicas,
fabtoken-fabric-t1-websocket,
fabtoken-fabric-t1-libp2p,
fabtoken-fabric-t1-replicas,
fabtoken-fabric-t2,
fabtoken-fabric-t3,
fabtoken-fabric-t4,
fabtoken-fabric-t5,
update-t1,
update-t2,
update-t3,
nft-dlog,
nft-fabtoken,
dvp-fabtoken,
dvp-dlog,
interop-fabtoken-t1,
interop-fabtoken-t3,
interop-fabtoken-t4,
interop-fabtoken-t5,
interop-dlog-t1,
interop-dlog-t3,
interop-dlog-t4,
interop-dlog-t5,
dlogstress-t1,
]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
- name: Set up tools
run: make install-tools
- name: Download fabric binaries
run: make download-fabric
- name: Docker
run: make docker-images
- name: Fabric-x setup
if: startsWith(matrix.tests, 'fabricx')
run: |
make fxconfig configtxgen fabricx-docker-images
- name: Run ${{ matrix.tests }}
run: |
mkdir -p covdata
GOCOVERDIR=$(realpath covdata) make integration-tests-${{ matrix.tests }}
go tool covdata textfmt -i=covdata -o coverage.profile
./ci/scripts/filter-coverage.sh coverage.profile coverage.profile
- name: Send coverage to Coveralls
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: coverage.profile
flag-name: itest-${{ matrix.tests }}
parallel: true
fail-on-error: false
publish-coverage:
needs: [ utest, itest ]
runs-on: ubuntu-latest
steps:
- name: Finish coverage report
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
fail-on-error: false
bench-check:
needs: checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
- name: Download dependencies
run: go mod download
- name: Compile benchmarks (do not run)
run: go test ./... -run=^$ -bench=^$
# Guard: the tokengen / artifactgen binaries must build without cgo so
# they can be distributed in scratch / alpine images and on hosts
# without a C toolchain. See #1445.
cgo-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
- name: Download dependencies
run: go mod download
- name: Build tokengen without cgo
env:
CGO_ENABLED: "0"
run: cd ./cmd/tokengen; go build -o /dev/null .
- name: Build artifactgen without cgo
env:
CGO_ENABLED: "0"
run: cd ./cmd/artifactgen; go build -o /dev/null .