-
Notifications
You must be signed in to change notification settings - Fork 53
387 lines (359 loc) · 14.6 KB
/
tests.yml
File metadata and controls
387 lines (359 loc) · 14.6 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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
name: Tests
on:
workflow_dispatch:
push:
branches:
- master
- "v*-dev"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- master
- "v*-dev"
- "ci/*"
schedule:
- cron: "0 23 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-secrets:
name: Check secret availability
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }}
runs-on: ubuntu-24.04
outputs:
has_ecr: ${{ steps.check.outputs.has_ecr }}
steps:
- name: Check if ECR credentials are available
id: check
run: |
if [[ -n "${{ secrets.AWS_ACCESS_KEY_ID }}" && -n "${{ secrets.AWS_ACCOUNT_ID }}" ]]; then
echo "has_ecr=true" >> "$GITHUB_OUTPUT"
else
echo "has_ecr=false" >> "$GITHUB_OUTPUT"
echo "::notice::ECR credentials not available — Docker image builds and dependent tests will be skipped (expected for fork PRs)"
fi
changes:
name: Determine changed packages
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }}
runs-on: ubuntu-24.04
outputs:
js-packages: ${{ steps.override.outputs.js-packages || steps.prune-pr-matrix.outputs.js-packages || steps.filter-js.outputs.changes }}
js-packages-direct: ${{ steps.override.outputs.js-packages-direct || steps.filter-js-direct.outputs.changes }}
rs-packages: ${{ steps.override.outputs.rs-packages || steps.filter-rs.outputs.changes }}
rs-workflows-changed: ${{ steps.filter-rs-workflows.outputs.rs-workflows }}
doctests-changed: ${{ steps.override.outputs.doctests-changed || steps.filter-doctests.outputs.doctests-changed }}
swift-sdk-changed: ${{ steps.override.outputs.swift-sdk-changed || steps.filter-swift-sdk.outputs.swift-sdk-changed }}
version-changed: ${{ steps.override.outputs.version-changed || steps.filter-version.outputs.version-changed }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter-js
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
filters: .github/package-filters/js-packages-no-workflows.yml
- uses: dorny/paths-filter@v3
id: filter-js-direct
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
filters: .github/package-filters/js-packages-direct.yml
- uses: dorny/paths-filter@v3
id: filter-rs
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
filters: .github/package-filters/rs-packages-no-workflows.yml
- uses: dorny/paths-filter@v3
id: filter-rs-workflows
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
filters: |
rs-workflows:
- .github/workflows/tests-rs-workspace.yml
- .github/workflows/tests-rs-doctests.yml
- .github/workflows/tests.yml
- name: Check for platform version change
id: filter-version
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
BASE_SHA="${{ github.event.pull_request.base.sha || github.event.before || 'HEAD~1' }}"
if git diff "$BASE_SHA"...HEAD -- Cargo.toml 2>/dev/null | grep -qE '^\+version\s*='; then
echo "version-changed=true" >> "$GITHUB_OUTPUT"
echo "Platform version changed — Docker builds and test suite will run"
else
echo "version-changed=false" >> "$GITHUB_OUTPUT"
echo "Platform version unchanged"
fi
- name: Check for doctest changes
id: filter-doctests
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
BASE_SHA="${{ github.event.pull_request.base.sha || github.event.before || 'HEAD~1' }}"
DIFF=$(git diff "$BASE_SHA"...HEAD -- '*.rs' 2>/dev/null || git diff HEAD~1 -- '*.rs')
# Look for added/removed lines in doc comments that contain code fences
if echo "$DIFF" | grep -qE '^[+-].*///.*```|^[+-].*//!.*```'; then
echo "doctests-changed=true" >> "$GITHUB_OUTPUT"
echo "Doc comments with code examples changed — doctests will run"
exit 0
fi
echo "doctests-changed=false" >> "$GITHUB_OUTPUT"
echo "No doctest changes — skipping doctests"
- name: Check for Swift SDK changes
id: filter-swift-sdk
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: dorny/paths-filter@v3
with:
filters: |
swift-sdk-changed:
- packages/swift-sdk/**
- packages/dapi-grpc/**
- packages/dashpay-contract/**
- packages/data-contracts/**
- packages/dpns-contract/**
- packages/keyword-search-contract/**
- packages/masternode-reward-shares-contract/**
- packages/rs-context-provider/**
- packages/rs-dapi-client/**
- packages/rs-dash-async/**
- packages/rs-dash-platform-macros/**
- packages/rs-dpp/**
- packages/rs-dpp-json-convertible-derive/**
- packages/rs-drive/**
- packages/rs-drive-proof-verifier/**
- packages/rs-json-schema-compatibility-validator/**
- packages/rs-platform-encryption/**
- packages/rs-platform-serialization/**
- packages/rs-platform-serialization-derive/**
- packages/rs-platform-value/**
- packages/rs-platform-value-convertible/**
- packages/rs-platform-version/**
- packages/rs-platform-versioning/**
- packages/rs-platform-wallet/**
- packages/rs-platform-wallet-ffi/**
- packages/rs-sdk/**
- packages/rs-sdk-ffi/**
- packages/rs-sdk-trusted-context-provider/**
- packages/rs-unified-sdk-ffi/**
- packages/simple-signer/**
- packages/token-history-contract/**
- packages/wallet-utils-contract/**
- packages/withdrawals-contract/**
# Drop @dashevo/wasm-dpp from the JS test matrix on
# `pull_request` events so the heaviest entry in the matrix
# only runs on the nightly schedule + manual
# `workflow_dispatch`. @dashevo/wasm-dpp2 stays on the PR
# path — it's a separate, lighter package that should be
# exercised on every PR. Cascading consumers
# (`dapi-client`, `wallet-lib`, `dash`, `dashmate`,
# `platform-test-suite`, `evo-sdk`) also keep running on PRs:
# their JS test code exercises behavior on top of wasm-dpp's
# already-built artifact, and `tests-build-js.yml` runs
# `yarn build` across the whole workspace so the wasm-dpp
# output is still compiled and linkable for them — just not
# test-driven on the PR critical path. To force wasm-dpp
# tests on a specific PR, use the `Run workflow`
# (workflow_dispatch) button on the Actions tab — that path
# goes through the `override` step below and runs every JS
# package.
- name: Skip wasm-dpp tests on pull_request (nightly-only)
id: prune-pr-matrix
if: ${{ github.event_name == 'pull_request' }}
run: |
set -eo pipefail
raw='${{ steps.filter-js.outputs.changes }}'
pruned=$(echo "$raw" | jq -c 'map(select(. != "@dashevo/wasm-dpp"))')
echo "js-packages=$pruned" >> "$GITHUB_OUTPUT"
echo "Pruned wasm-dpp from PR matrix:"
echo " before: $raw"
echo " after: $pruned"
- name: Override all outputs for workflow_dispatch
id: override
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
set -eo pipefail
# Extract top-level keys from filter YAML files to build JSON arrays
to_json() { yq -o=json '[keys | .[] ]' "$1" | tr -d '\n'; }
echo "js-packages=$(to_json .github/package-filters/js-packages-no-workflows.yml)" >> "$GITHUB_OUTPUT"
echo "js-packages-direct=$(to_json .github/package-filters/js-packages-direct.yml)" >> "$GITHUB_OUTPUT"
echo "rs-packages=$(to_json .github/package-filters/rs-packages-no-workflows.yml)" >> "$GITHUB_OUTPUT"
echo 'doctests-changed=true' >> "$GITHUB_OUTPUT"
echo 'swift-sdk-changed=true' >> "$GITHUB_OUTPUT"
echo 'version-changed=true' >> "$GITHUB_OUTPUT"
build-js:
name: Build JS packages
needs:
- changes
if: ${{ needs.changes.outputs.js-packages != '[]' || needs.changes.outputs.version-changed == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
secrets: inherit
uses: ./.github/workflows/tests-build-js.yml
build-images:
name: Build Docker images
needs:
- check-secrets
- changes
# Build Docker images on version change, nightly schedule, or manual dispatch
if: >-
needs.check-secrets.outputs.has_ecr == 'true' &&
(needs.changes.outputs.version-changed == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
secrets: inherit
strategy:
fail-fast: false
matrix:
include:
- name: Drive
image_name: drive
target: drive-abci
build_args: |
SDK_TEST_DATA=true
- name: RS-DAPI
image_name: rs-dapi
target: rs-dapi
- name: Dashmate helper
image_name: dashmate-helper
target: dashmate-helper
uses: ./.github/workflows/tests-build-image.yml
with:
name: ${{ matrix.name }}
image_name: ${{ matrix.image_name }}
target: ${{ matrix.target }}
build_args: ${{ matrix.build_args }}
rs-workspace-tests:
name: Rust workspace tests
needs:
- changes
if: ${{ needs.changes.outputs.rs-packages != '[]' || needs.changes.outputs.rs-workflows-changed == 'true' }}
secrets: inherit
uses: ./.github/workflows/tests-rs-workspace.yml
with:
doctests-changed: ${{ needs.changes.outputs.doctests-changed == 'true' }}
rs-doctests:
name: Rust doctests
needs:
- changes
if: ${{ needs.changes.outputs.doctests-changed == 'true' }}
secrets: inherit
uses: ./.github/workflows/tests-rs-doctests.yml
swift-sdk-build:
name: Swift SDK build
needs:
- changes
- rs-workspace-tests
if: ${{ always() && needs.changes.outputs.swift-sdk-changed == 'true' && needs.changes.result != 'failure' && needs.rs-workspace-tests.result != 'failure' }}
secrets: inherit
uses: ./.github/workflows/swift-sdk-build.yml
js-packages:
name: JS packages
needs:
- changes
- build-js
if: ${{ needs.changes.outputs.js-packages != '[]' }}
secrets: inherit
strategy:
fail-fast: false
matrix:
js-package: ${{ fromJson(needs.changes.outputs.js-packages) }}
uses: ./.github/workflows/tests-js-package.yml
with:
package: ${{ matrix.js-package }}
test-command: ${{ matrix.js-package == 'dashmate' && 'test:unit' || 'test' }}
skip-tests: ${{ contains(matrix.js-package, 'platform-test-suite') }}
direct-packages: ${{ needs.changes.outputs.js-packages-direct }}
js-deps-versions:
name: JS dependency versions check
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }}
runs-on: ubuntu-24.04
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Setup Node.JS
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Enable corepack
run: corepack enable
- name: Validate workspaces
run: yarn constraints
dashmate-e2e-tests:
name: Dashmate E2E tests
secrets: inherit
needs:
- changes
- build-js
- build-images
- check-secrets
strategy:
fail-fast: false
matrix:
include:
- name: Local network
test-pattern: test/e2e/localNetwork.spec.js
restore_local_network_data: true
- name: Testnet fullnode
test-pattern: test/e2e/testnetFullnode.spec.js
restore_local_network_data: false
- name: Testnet Evonode
test-pattern: test/e2e/testnetEvonode.spec.js
restore_local_network_data: false
uses: ./.github/workflows/tests-dashmate.yml
with:
name: ${{ matrix.name }}
test-pattern: ${{ matrix.test-pattern }}
restore_local_network_data: ${{ matrix.restore_local_network_data }}
if: >-
always() &&
needs.check-secrets.outputs.has_ecr == 'true' &&
needs.build-images.result == 'success' &&
(needs.changes.outputs.version-changed == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
test-suite:
name: Test Suite
needs:
- changes
- build-js
- build-images
- check-secrets
secrets: inherit
if: >-
always() &&
needs.check-secrets.outputs.has_ecr == 'true' &&
needs.build-js.result == 'success' &&
needs.build-images.result == 'success' &&
(needs.changes.outputs.version-changed == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
strategy:
fail-fast: false
matrix:
include:
- name: Test Suite
command: test:suite
batch_index: 0
batch_total: 0
- name: Test Suite in browser (1)
command: test:browsers
batch_index: 0
batch_total: 2
- name: Test Suite in browser (2)
command: test:browsers
batch_index: 1
batch_total: 2
uses: ./.github/workflows/tests-test-suite.yml
with:
name: ${{ matrix.name }}
command: ${{ matrix.command }}
batch_total: ${{ matrix.batch_total }}
batch_index: ${{ matrix.batch_index }}
test-functional:
name: Packages functional tests
needs:
- changes
- build-js
- build-images
- check-secrets
secrets: inherit
if: >-
always() &&
needs.check-secrets.outputs.has_ecr == 'true' &&
needs.build-js.result == 'success' &&
needs.build-images.result == 'success' &&
(needs.changes.outputs.version-changed == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: ./.github/workflows/tests-packges-functional.yml