@@ -24,155 +24,24 @@ jobs:
24
24
name : Discover Test Groups
25
25
runs-on : ubuntu-latest
26
26
outputs :
27
- groups : ${{ steps.test .outputs.groups }}
27
+ test_group_execution_contexts : ${{ steps.list_test_group_execution_contexts .outputs.test_group_execution_contexts }}
28
28
steps :
29
29
- uses : actions/checkout@v4
30
30
with :
31
31
submodules : ' recursive'
32
32
fetch-depth : 0
33
- - id : test
34
- env :
35
- # Unit test groups other than unit-rest
36
- utests : |
37
- [
38
- {"name": "unit-cli", "packages": ["./cli/...", "./cmd/...", "./api/..."]},
39
- {"name": "unit-storage", "packages": ["./storage/...", "./extern/..."]},
40
- {"name": "unit-node", "packages": ["./node/..."]}
41
- ]
42
- # Other tests that require special configuration
43
- otests : |
44
- [
45
- {
46
- "name": "multicore-sdr",
47
- "packages": ["./storage/sealer/ffiwrapper"],
48
- "go_test_flags": "-run=TestMulticoreSDR",
49
- "test_rustproofs_logs": "1"
50
- }, {
51
- "name": "conformance",
52
- "packages": ["./conformance"],
53
- "go_test_flags": "-run=TestConformance",
54
- "skip_conformance": "0"
55
- }
56
- ]
57
- # Mapping from test group names to custom runner labels
58
- # The jobs default to running on the default hosted runners (4 CPU, 16 RAM).
59
- # We use self-hosted xlarge (4 CPU, 8 RAM; and large - 2 CPU, 4 RAM) runners
60
- # to extend the available runner capacity (60 default hosted runners).
61
- # We use self-hosted 4xlarge (16 CPU, 32 RAM; and 2xlarge - 8 CPU, 16 RAM) self-hosted
62
- # to support resource intensive jobs.
63
- runners : |
64
- {
65
- "itest-niporep_manual": ["self-hosted", "linux", "x64", "4xlarge"],
66
- "itest-sector_pledge": ["self-hosted", "linux", "x64", "4xlarge"],
67
- "itest-worker": ["self-hosted", "linux", "x64", "4xlarge"],
68
- "itest-manual_onboarding": ["self-hosted", "linux", "x64", "4xlarge"],
69
-
70
- "itest-gateway": ["self-hosted", "linux", "x64", "2xlarge"],
71
- "itest-sector_import_full": ["self-hosted", "linux", "x64", "2xlarge"],
72
- "itest-sector_import_simple": ["self-hosted", "linux", "x64", "2xlarge"],
73
- "itest-wdpost": ["self-hosted", "linux", "x64", "2xlarge"],
74
- "unit-storage": ["self-hosted", "linux", "x64", "2xlarge"],
75
-
76
- "itest-cli": ["self-hosted", "linux", "x64", "xlarge"],
77
- "itest-deals_invalid_utf8_label": ["self-hosted", "linux", "x64", "xlarge"],
78
- "itest-decode_params": ["self-hosted", "linux", "x64", "xlarge"],
79
- "itest-dup_mpool_messages": ["self-hosted", "linux", "x64", "xlarge"],
80
- "itest-eth_account_abstraction": ["self-hosted", "linux", "x64", "xlarge"],
81
- "itest-eth_api": ["self-hosted", "linux", "x64", "xlarge"],
82
- "itest-eth_balance": ["self-hosted", "linux", "x64", "xlarge"],
83
- "itest-eth_bytecode": ["self-hosted", "linux", "x64", "xlarge"],
84
- "itest-eth_config": ["self-hosted", "linux", "x64", "xlarge"],
85
- "itest-eth_conformance": ["self-hosted", "linux", "x64", "xlarge"],
86
- "itest-eth_deploy": ["self-hosted", "linux", "x64", "xlarge"],
87
- "itest-eth_fee_history": ["self-hosted", "linux", "x64", "xlarge"],
88
- "itest-eth_transactions": ["self-hosted", "linux", "x64", "xlarge"],
89
- "itest-fevm_address": ["self-hosted", "linux", "x64", "xlarge"],
90
- "itest-fevm_events": ["self-hosted", "linux", "x64", "xlarge"],
91
- "itest-gas_estimation": ["self-hosted", "linux", "x64", "xlarge"],
92
- "itest-get_messages_in_ts": ["self-hosted", "linux", "x64", "xlarge"],
93
- "itest-lite_migration": ["self-hosted", "linux", "x64", "xlarge"],
94
- "itest-lookup_robust_address": ["self-hosted", "linux", "x64", "xlarge"],
95
- "itest-mempool": ["self-hosted", "linux", "x64", "xlarge"],
96
- "itest-mpool_msg_uuid": ["self-hosted", "linux", "x64", "xlarge"],
97
- "itest-mpool_push_with_uuid": ["self-hosted", "linux", "x64", "xlarge"],
98
- "itest-msgindex": ["self-hosted", "linux", "x64", "xlarge"],
99
- "itest-multisig": ["self-hosted", "linux", "x64", "xlarge"],
100
- "itest-net": ["self-hosted", "linux", "x64", "xlarge"],
101
- "itest-nonce": ["self-hosted", "linux", "x64", "xlarge"],
102
- "itest-path_detach_redeclare": ["self-hosted", "linux", "x64", "xlarge"],
103
- "itest-pending_deal_allocation": ["self-hosted", "linux", "x64", "xlarge"],
104
- "itest-remove_verifreg_datacap": ["self-hosted", "linux", "x64", "xlarge"],
105
- "itest-sector_miner_collateral": ["self-hosted", "linux", "x64", "xlarge"],
106
- "itest-sector_numassign": ["self-hosted", "linux", "x64", "xlarge"],
107
- "itest-self_sent_txn": ["self-hosted", "linux", "x64", "xlarge"],
108
- "itest-verifreg": ["self-hosted", "linux", "x64", "xlarge"],
109
- "multicore-sdr": ["self-hosted", "linux", "x64", "xlarge"],
110
- "unit-node": ["self-hosted", "linux", "x64", "xlarge"]
111
- }
112
- # A list of test groups that require Proof Parameters to be fetched
113
- parameters : |
114
- [
115
- "conformance",
116
- "itest-api",
117
- "itest-direct_data_onboard_verified",
118
- "itest-direct_data_onboard",
119
- "itest-manual_onboarding",
120
- "itest-niporep_manual",
121
- "itest-net",
122
- "itest-path_detach_redeclare",
123
- "itest-sealing_resources",
124
- "itest-sector_import_full",
125
- "itest-sector_import_simple",
126
- "itest-sector_pledge",
127
- "itest-sector_unseal",
128
- "itest-wdpost_no_miner_storage",
129
- "itest-wdpost_worker_config",
130
- "itest-wdpost",
131
- "itest-worker",
132
- "multicore-sdr",
133
- "unit-cli",
134
- "unit-storage"
135
- ]
33
+ - id : list_test_group_execution_contexts
136
34
run : |
137
- # Create a list of integration test groups
138
- itests="$(
139
- find ./itests -name "*_test.go" | \
140
- jq -R '{
141
- "name": "itest-\(. | split("/") | .[2] | sub("_test.go$";""))",
142
- "packages": [.]
143
- }' | jq -s
144
- )"
145
-
146
- # Create a list of packages that are covered by the integration and unit tests
147
- packages="$(jq -n --argjson utests "$utests" '$utests | map(.packages) | flatten | . + ["./itests/..."]')"
148
-
149
- # Create a new group for the unit tests that are not yet covered
150
- rest="$(
151
- find . -name "*_test.go" | cut -d/ -f2 | sort | uniq | \
152
- jq -R '"./\(.)/..."' | \
153
- jq -s --argjson p "$packages" '{"name": "unit-rest", "packages": (. - $p)}'
154
- )"
155
-
156
- # Combine the groups for integration tests, unit tests, the new unit-rest group, and the other tests
157
- groups="$(jq -n --argjson i "$itests" --argjson u "$utests" --argjson r "$rest" --argjson o "$otests" '$i + $u + [$r] + $o')"
158
-
159
- # Apply custom runner labels to the groups
160
- groups="$(jq -n --argjson g "$groups" --argjson r "$runners" '$g | map(. + {"runner": (.name as $n | $r | .[$n]) })')"
161
-
162
- # Apply the needs_parameters flag to the groups
163
- groups="$(jq -n --argjson g "$groups" --argjson p "$parameters" '$g | map(. + {"needs_parameters": ([.name] | inside($p)) })')"
164
-
165
- # Output the groups
166
- echo "groups=$groups"
167
- echo "groups=$(jq -nc --argjson g "$groups" '$g')" >> $GITHUB_OUTPUT
35
+ echo "test_group_execution_contexts<<EOF" >> $GITHUB_OUTPUT
36
+ go run ./cmd/ci/main.go --json list-test-group-execution-contexts | jq -r '.msg' | tee -a $GITHUB_OUTPUT
37
+ echo "EOF" >> $GITHUB_OUTPUT
168
38
cache :
169
39
name : Cache Dependencies
170
- runs-on : ubuntu-latest
171
- outputs :
172
- fetch_params_key : ${{ steps.fetch_params.outputs.key }}
173
- fetch_params_path : ${{ steps.fetch_params.outputs.path }}
174
- make_deps_key : ${{ steps.make_deps.outputs.key }}
175
- make_deps_path : ${{ steps.make_deps.outputs.path }}
40
+ runs-on : ${{ matrix.runner }}
41
+ strategy :
42
+ matrix :
43
+ # We need to cache for each architecture we support: x86_64 and arm64
44
+ runner : [ubuntu-latest, ubuntu-24.04-arm]
176
45
steps :
177
46
- uses : actions/checkout@v4
178
47
with :
@@ -230,35 +99,76 @@ jobs:
230
99
with :
231
100
key : ${{ steps.make_deps.outputs.key }}
232
101
path : ${{ steps.make_deps.outputs.path }}
102
+ - env :
103
+ fetch_params_key : ${{ steps.fetch_params.outputs.key }}
104
+ fetch_params_path : ${{ steps.fetch_params.outputs.path }}
105
+ make_deps_key : ${{ steps.make_deps.outputs.key }}
106
+ make_deps_path : ${{ steps.make_deps.outputs.path }}
107
+ file : jobs.cache.${{ runner.os }}.${{ runner.arch }}.outputs.json
108
+ run : |
109
+ jq -n '{
110
+ "fetch_params_key": env.fetch_params_key,
111
+ "fetch_params_path": env.fetch_params_path,
112
+ "make_deps_key": env.make_deps_key,
113
+ "make_deps_path": env.make_deps_path
114
+ }' | tee -a "$file"
115
+ - uses : actions/upload-artifact@v4
116
+ with :
117
+ name : jobs.cache.${{ runner.os }}.${{ runner.arch }}.outputs
118
+ path : jobs.cache.${{ runner.os }}.${{ runner.arch }}.outputs.json
233
119
test :
234
120
needs : [discover, cache]
235
- name : Test (${{ matrix.name }})
236
- runs-on : ${{ github.repository_owner == 'filecoin-project' && matrix.runner || 'ubuntu-latest' }}
121
+ name : Test (${{ matrix.name }}) ${{ toJson(matrix.runner) }}
122
+ runs-on : ${{ matrix.runner }}
237
123
strategy :
238
124
fail-fast : false
239
125
matrix :
240
- include : ${{ fromJson(needs.discover.outputs.groups ) }}
126
+ include : ${{ fromJson(needs.discover.outputs.test_group_execution_contexts ) }}
241
127
steps :
242
128
- uses : actions/checkout@v4
243
129
with :
244
130
submodules : ' recursive'
245
131
fetch-depth : 0
246
132
- uses : ./.github/actions/install-system-dependencies
247
133
- uses : ./.github/actions/install-go
134
+ - id : group
135
+ run : |
136
+ echo "metadata<<EOF" >> $GITHUB_OUTPUT
137
+ go run ./cmd/ci/main.go --json get-test-group-metadata --name "${{ matrix.name }}" | jq -r '.msg' | tee -a $GITHUB_OUTPUT
138
+ echo "EOF" >> $GITHUB_OUTPUT
248
139
- name : Install gotestsum
249
140
run : go install gotest.tools/gotestsum@latest
141
+ - id : artifact
142
+ uses : actions/download-artifact@v4
143
+ with :
144
+ name : jobs.cache.${{ runner.os }}.${{ runner.arch }}.outputs
145
+ - id : cache
146
+ env :
147
+ file : jobs.cache.${{ runner.os }}.${{ runner.arch }}.outputs.json
148
+ run : |
149
+ echo "make_deps_key=$(jq -r .make_deps_key "$file")" | tee -a $GITHUB_OUTPUT
150
+ echo "make_deps_path<<EOF" | tee -a $GITHUB_OUTPUT
151
+ jq -r .make_deps_path "$file" | tee -a $GITHUB_OUTPUT
152
+ echo "EOF" | tee -a $GITHUB_OUTPUT
153
+
154
+ echo "fetch_params_key=$(jq -r .fetch_params_key "$file")" | tee -a $GITHUB_OUTPUT
155
+ echo "fetch_params_path<<EOF" | tee -a $GITHUB_OUTPUT
156
+ jq -r .fetch_params_path "$file" | tee -a $GITHUB_OUTPUT
157
+ echo "EOF" | tee -a $GITHUB_OUTPUT
158
+
159
+ rm "$file"
250
160
- name : Restore cached make deps outputs
251
161
uses : actions/cache/restore@v4
252
162
with :
253
- key : ${{ needs .cache.outputs.make_deps_key }}
254
- path : ${{ needs .cache.outputs.make_deps_path }}
163
+ key : ${{ steps .cache.outputs.make_deps_key }}
164
+ path : ${{ steps .cache.outputs.make_deps_path }}
255
165
fail-on-cache-miss : true
256
- - if : ${{ matrix .needs_parameters }}
166
+ - if : ${{ fromJson(steps.group.outputs.metadata) .needs_parameters }}
257
167
name : Restore cached fetch params outputs
258
168
uses : actions/cache/restore@v4
259
169
with :
260
- key : ${{ needs .cache.outputs.fetch_params_key }}
261
- path : ${{ needs .cache.outputs.fetch_params_path }}
170
+ key : ${{ steps .cache.outputs.fetch_params_key }}
171
+ path : ${{ steps .cache.outputs.fetch_params_path }}
262
172
fail-on-cache-miss : true
263
173
# TODO: Install statediff (used to be used for conformance)
264
174
- name : Create temporary directory for reports
@@ -270,22 +180,22 @@ jobs:
270
180
NAME : ${{ matrix.name }}
271
181
LOTUS_SRC_DIR : ${{ github.workspace }}
272
182
REPORTS_PATH : ${{ steps.reports.outputs.path }}
273
- SKIP_CONFORMANCE : ${{ matrix. skip_conformance || '1 ' }}
274
- TEST_RUSTPROOFS_LOGS : ${{ matrix. test_rustproofs_logs || '0' }}
275
- FORMAT : ${{ matrix .format || 'standard-verbose' }}
276
- PACKAGES : ${{ join(matrix .packages, ' ') }}
183
+ SKIP_CONFORMANCE : ${{ fromJson(steps.group.outputs.metadata). skip_conformance && '1' || '0 ' }}
184
+ TEST_RUSTPROOFS_LOGS : ${{ fromJson(steps.group.outputs.metadata). test_rustproofs_logs && '1' || '0' }}
185
+ FORMAT : ${{ fromJson(steps.group.outputs.metadata) .format || 'standard-verbose' }}
186
+ PACKAGES : ${{ join(fromJson(steps.group.outputs.metadata) .packages, ' ') }}
277
187
run : |
278
188
gotestsum \
279
189
--format "$FORMAT" \
280
190
--junitfile "$REPORTS_PATH/$NAME.xml" \
281
191
--jsonfile "$REPORTS_PATH/$NAME.json" \
282
192
--packages="$PACKAGES" \
283
- -- ${{ matrix .go_test_flags || '' }}
193
+ -- ${{ fromJson(steps.group.outputs.metadata) .go_test_flags || '' }}
284
194
- name : Modify junit.xml for BuildPulse
285
195
env :
286
196
NAME : ${{ matrix.name }}
287
197
REPORTS_PATH : ${{ steps.reports.outputs.path }}
288
- PACKAGES : ${{ join(matrix .packages, ' ') }}
198
+ PACKAGES : ${{ join(fromJson(steps.group.outputs.metadata) .packages, ' ') }}
289
199
if : always()
290
200
run : |
291
201
# Modify test suite name and classname attributes in JUnit XML for better grouping
@@ -303,7 +213,7 @@ jobs:
303
213
- if : success() || failure()
304
214
uses : actions/upload-artifact@v4
305
215
with :
306
- name : ${{ matrix.name }}
216
+ name : ${{ matrix.name }}-${{ runner.os }}-${{ runner.arch }}
307
217
path : |
308
218
${{ steps.reports.outputs.path }}/${{ matrix.name }}.xml
309
219
${{ steps.reports.outputs.path }}/${{ matrix.name }}.json
0 commit comments