@@ -13,58 +13,20 @@ jobs:
13
13
strategy :
14
14
fail-fast : false
15
15
matrix :
16
- project : [
17
- mithril-core,
18
- mithril-common,
19
- mithril-aggregator,
20
- mithril-client,
21
- mithril-signer,
22
- mithril-test-lab/mithril-end-to-end,
23
- demo/protocol-demo
24
- ]
25
- os : [ubuntu-22.04]
16
+ os : [ ubuntu-22.04, macos-12, windows-latest ]
26
17
27
18
include :
28
- - project : mithril-core
29
- cargo_project_name : mithril
30
- artifacts_pattern : libmithril
31
- - project : mithril-common
32
- artifacts_pattern : libmithril_common
33
- - project : mithril-client
34
- os : macos-latest
35
- - project : mithril-client
36
- os : windows-latest
37
- - project : mithril-test-lab/mithril-end-to-end
38
- cargo_project_name : mithril-end-to-end
39
- artifacts_base_name : mithril-end-to-end
40
- artifacts_pattern : mithril-end-to-end
41
- - project : demo/protocol-demo
42
- cargo_project_name : mithrildemo
43
- artifacts_base_name : mithrildemo
44
- artifacts_pattern : mithrildemo
45
- env :
46
- CARGO_PROJECT_NAME : ${{ matrix.project }}
47
- ARTIFACTS_BASE_NAME : ${{ matrix.project }}
48
- ARTIFACTS_PATTERN : ${{ matrix.project }}
49
-
19
+ # Only build client on windows & mac
20
+ - os : macos-12
21
+ build-args : -p mithril-client
22
+ - os : windows-latest
23
+ build-args : -p mithril-client
50
24
runs-on : ${{ matrix.os }}
51
25
52
26
steps :
53
27
- name : Checkout sources
54
28
uses : actions/checkout@v3
55
29
56
- - name : Overriding default $CARGO_PROJECT_NAME with matrix value
57
- if : ${{ matrix.cargo_project_name }}
58
- run : echo "CARGO_PROJECT_NAME=${{ matrix.cargo_project_name }}" >> $GITHUB_ENV
59
-
60
- - name : Overriding default $ARTIFACTS_BASE_NAME with matrix value
61
- if : ${{ matrix.artifacts_base_name }}
62
- run : echo "ARTIFACTS_BASE_NAME=${{ matrix.artifacts_base_name }}" >> $GITHUB_ENV
63
-
64
- - name : Overriding default $ARTIFACTS_PATTERN with matrix value
65
- if : ${{ matrix.artifacts_pattern }}
66
- run : echo "ARTIFACTS_PATTERN=${{ matrix.artifacts_pattern }}" >> $GITHUB_ENV
67
-
68
30
- name : Install stable toolchain
69
31
uses : actions-rs/toolchain@v1
70
32
with :
@@ -81,64 +43,64 @@ jobs:
81
43
uses : actions-rs/cargo@v1
82
44
with :
83
45
command : build
84
- args : --release --features portable -p ${{ env.CARGO_PROJECT_NAME }}
46
+ args : --release ${{ matrix.build-args }}
85
47
86
- - name : Publish ${{ matrix.project }} (${{ runner.os }}-${{ runner.arch }})
48
+ - name : Publish Mithril Distribution (${{ runner.os }}-${{ runner.arch }})
87
49
uses : actions/upload-artifact@v3
88
50
with :
89
- name : ${{ env.ARTIFACTS_BASE_NAME }} -${{ runner.os }}-${{ runner.arch }}
51
+ name : mithril-distribution -${{ runner.os }}-${{ runner.arch }}
90
52
path : |
91
- target/release/${{ env.ARTIFACTS_PATTERN }}*
53
+ target/release/libmithril.*
54
+ target/release/libmithril_common.*
55
+ target/release/mithril-aggregator
56
+ target/release/mithril-aggregator.exe
57
+ target/release/mithril-client
58
+ target/release/mithril-client.exe
59
+ target/release/mithril-signer
60
+ target/release/mithril-signer.exe
61
+ target/release/mithrildemo
62
+ target/release/mithrildemo.exe
63
+ if-no-files-found : error
64
+
65
+ - name : Publish End-to-end runner (${{ runner.os }}-${{ runner.arch }})
66
+ uses : actions/upload-artifact@v3
67
+ if : ${{ runner.os == 'Linux' }}
68
+ with :
69
+ name : mithril-end-to-end-${{ runner.os }}-${{ runner.arch }}
70
+ path : target/release/mithril-end-to-end
92
71
if-no-files-found : error
93
72
94
73
test :
95
74
strategy :
96
75
fail-fast : false
97
76
matrix :
98
- project : [
99
- mithril-core,
100
- mithril-common,
101
- mithril-aggregator,
102
- mithril-client,
103
- mithril-signer,
104
- mithril-test-lab/mithril-end-to-end,
105
- demo/protocol-demo
106
- ]
107
- os : [ubuntu-22.04]
77
+ title : [ "mithril" ]
78
+ os : [ ubuntu-22.04, macos-12, windows-latest ]
108
79
109
80
include :
110
- - project : mithril-core
111
- cargo_project_name : mithril
112
- cargo-args : --release # Mithril core tests are ~2x quicker on release build
113
- - project : mithril-common
114
- - project : mithril-client
115
- os : macos-latest
116
- - project : mithril-client
117
- os : windows-latest
118
- - project : mithril-test-lab/mithril-end-to-end
119
- cargo_project_name : mithril-end-to-end
120
- artifacts_base_name : mithril-end-to-end
121
- - project : demo/protocol-demo
122
- cargo_project_name : mithrildemo
123
- artifacts_base_name : mithrildemo
124
- env :
125
- CARGO_PROJECT_NAME : ${{ matrix.project }}
126
- ARTIFACTS_BASE_NAME : ${{ matrix.project }}
81
+ - os : ubuntu-22.04
82
+ build-args : --workspace
83
+ test-args : --workspace --exclude mithril # mithril core is tested separately since it's slow
84
+ - title : mithril-core
85
+ os : ubuntu-22.04
86
+ # Mithril core tests are ~2x faster on release build
87
+ build-args : --release -p mithril
88
+ test-args : --release -p mithril
89
+ artifact-suffix : -mithril-core
90
+ # Only test client on windows & mac (since its the only binaries supported for those os for now)
91
+ - os : macos-12
92
+ build-args : -p mithril-client
93
+ test-args : -p mithril-client
94
+ - os : windows-latest
95
+ build-args : -p mithril-client
96
+ test-args : -p mithril-client
127
97
128
98
runs-on : ${{ matrix.os }}
129
99
130
100
steps :
131
101
- name : Checkout sources
132
102
uses : actions/checkout@v3
133
103
134
- - name : Overriding default $CARGO_PROJECT_NAME with matrix value
135
- if : ${{ matrix.cargo_project_name }}
136
- run : echo "CARGO_PROJECT_NAME=${{ matrix.cargo_project_name }}" >> $GITHUB_ENV
137
-
138
- - name : Overriding default $ARTIFACTS_BASE_NAME with matrix value
139
- if : ${{ matrix.artifacts_base_name }}
140
- run : echo "ARTIFACTS_BASE_NAME=${{ matrix.artifacts_base_name }}" >> $GITHUB_ENV
141
-
142
104
- name : Install stable toolchain
143
105
uses : actions-rs/toolchain@v1
144
106
with :
@@ -152,30 +114,23 @@ jobs:
152
114
key : ${{ runner.os }}-cache-v${{ secrets.CACHE_VERSION }}
153
115
154
116
- name : Install cargo tools
155
- if : ${{ steps.cargo-cache.outputs.cache-hit == false }}
156
117
shell : bash
157
118
run : |
158
119
cargo install cargo2junit 2>/dev/null || true # Suppress the "binary `xyz` already exists in destination" error
159
120
160
- - name : Cargo build
161
- uses : actions-rs/cargo@v1
162
- with :
163
- command : build
164
- args : --tests --features portable -p ${{ env.CARGO_PROJECT_NAME }} ${{ matrix.cargo-args }}
165
-
166
121
- name : Run tests
167
122
shell : bash
168
123
run : |
169
124
set -o pipefail && \
170
- cargo test --features portable -p $CARGO_PROJECT_NAME -- no-fail-fast ${{ matrix.cargo -args }} \
125
+ cargo test --features portable -- no-fail-fast ${{ matrix.test -args }} \
171
126
-- -Z unstable-options --format json --report-time \
172
- | tee >(cargo2junit > test-results- ${{ env.artifacts_base_name }}-${{ runner.os }}-${{ runner.arch }}.xml)
127
+ | tee >(cargo2junit > test-results${{ matrix.artifact-suffix }}-${{ runner.os }}-${{ runner.arch }}.xml)
173
128
174
129
- name : Upload Tests Results
175
130
uses : actions/upload-artifact@v3
176
131
if : ${{ success() || failure() }}
177
132
with :
178
- name : test-results- ${{ env.ARTIFACTS_BASE_NAME }}-${{ runner.os }}-${{ runner.arch }}
133
+ name : test-results${{ matrix.artifact-suffix }}-${{ runner.os }}-${{ runner.arch }}
179
134
path : |
180
135
./**/test-results-*.xml
181
136
@@ -234,22 +189,10 @@ jobs:
234
189
- name : Checkout sources
235
190
uses : actions/checkout@v3
236
191
237
- - name : Download aggregator
238
- uses : actions/download-artifact@v3
239
- with :
240
- name : mithril-aggregator-${{ runner.os }}-${{ runner.arch }}
241
- path : ./bin
242
-
243
- - name : Download signer
192
+ - name : Download binaries
244
193
uses : actions/download-artifact@v3
245
194
with :
246
- name : mithril-signer-${{ runner.os }}-${{ runner.arch }}
247
- path : ./bin
248
-
249
- - name : Download client
250
- uses : actions/download-artifact@v3
251
- with :
252
- name : mithril-client-${{ runner.os }}-${{ runner.arch }}
195
+ name : mithril-distribution-${{ runner.os }}-${{ runner.arch }}
253
196
path : ./bin
254
197
255
198
- name : Download rust test runner
@@ -288,60 +231,30 @@ jobs:
288
231
needs :
289
232
- test
290
233
steps :
291
- - name : Download mithril-core Tests Results
234
+ - name : Download Tests Results (${{ runner.os }}-${{ runner.arch }})
292
235
if : ${{ success() || failure() }}
293
236
uses : actions/download-artifact@v3
294
237
with :
295
- name : test-results-mithril-core- ${{ runner.os }}-${{ runner.arch }}
238
+ name : test-results-${{ runner.os }}-${{ runner.arch }}
296
239
297
- - name : Download mithril-common Tests Results
240
+ - name : Download mithril-core Tests Results (${{ runner.os }}-${{ runner.arch }})
298
241
if : ${{ success() || failure() }}
299
242
uses : actions/download-artifact@v3
300
243
with :
301
- name : test-results-mithril-common-${{ runner.os }}-${{ runner.arch }}
302
-
303
- - name : Download mithril-aggregator Tests Results
304
- if : ${{ success() || failure() }}
305
- uses : actions/download-artifact@v3
306
- with :
307
- name : test-results-mithril-aggregator-${{ runner.os }}-${{ runner.arch }}
308
-
309
- - name : Download mithril-client (${{ runner.os }}-${{ runner.arch }}) Tests Results
310
- if : ${{ success() || failure() }}
311
- uses : actions/download-artifact@v3
312
- with :
313
- name : test-results-mithril-client-${{ runner.os }}-${{ runner.arch }}
314
-
315
- - name : Download mithril-client (macOS-X64) Tests Results
316
- if : ${{ success() || failure() }}
317
- uses : actions/download-artifact@v3
318
- with :
319
- name : test-results-mithril-client-macOS-X64
320
-
321
- - name : Download mithril-client (Windows-X64) Tests Results
322
- if : ${{ success() || failure() }}
323
- uses : actions/download-artifact@v3
324
- with :
325
- name : test-results-mithril-client-Windows-X64
244
+ name : test-results-mithril-core-${{ runner.os }}-${{ runner.arch }}
326
245
327
- - name : Download mithril-signer Tests Results
246
+ - name : Download Tests Results (macOS-X64)
328
247
if : ${{ success() || failure() }}
329
248
uses : actions/download-artifact@v3
330
249
with :
331
- name : test-results-mithril-signer-${{ runner.os }}-${{ runner.arch }}
250
+ name : test-results-macOS-X64
332
251
333
- - name : Download mithril-end-to-end Tests Results
252
+ - name : Download Tests Results (Windows-X64)
334
253
if : ${{ success() || failure() }}
335
254
uses : actions/download-artifact@v3
336
255
with :
337
- name : test-results-mithril-end-to-end-${{ runner.os }}-${{ runner.arch }}
256
+ name : test-results-Windows-X64
338
257
339
- - name : Download mithril-demo Tests Results
340
- if : ${{ success() || failure() }}
341
- uses : actions/download-artifact@v3
342
- with :
343
- name : test-results-mithrildemo-${{ runner.os }}-${{ runner.arch }}
344
-
345
258
- name : Publish Unit Test Results
346
259
if : ${{ success() || failure() }}
347
260
uses : EnricoMi/publish-unit-test-result-action@v1
@@ -350,7 +263,6 @@ jobs:
350
263
351
264
docker-mithril :
352
265
runs-on : ubuntu-22.04
353
- if : ${{ github.event_name == 'push' }}
354
266
needs :
355
267
- build
356
268
- check
@@ -393,10 +305,10 @@ jobs:
393
305
unstable
394
306
type=raw,value={{branch}}-{{sha}}
395
307
396
- - name : Download ${{ matrix.project }} executable
308
+ - name : Download built artifacts
397
309
uses : actions/download-artifact@v3
398
310
with :
399
- name : ${{ matrix.project }} -${{ runner.os }}-${{ runner.arch }}
311
+ name : mithril-distribution -${{ runner.os }}-${{ runner.arch }}
400
312
path : ${{ matrix.project }}
401
313
402
314
- name : Build and push Docker image
@@ -408,51 +320,33 @@ jobs:
408
320
tags : ${{ steps.meta.outputs.tags }}
409
321
410
322
unstable-release :
411
- if : github.ref == 'refs/heads/main' && github.event_name == 'push'
412
323
runs-on : ubuntu-22.04
413
324
needs :
414
325
- build
415
326
- test
416
327
- run-test-lab
417
328
- check
418
329
steps :
419
- - name : Download mithril-core lib
420
- uses : actions/download-artifact@v3
421
- with :
422
- name : mithril-core-${{ runner.os }}-${{ runner.arch }}
423
- path : ./build
424
-
425
- - name : Download aggregator
426
- uses : actions/download-artifact@v3
427
- with :
428
- name : mithril-aggregator-${{ runner.os }}-${{ runner.arch }}
429
- path : ./build
430
-
431
- - name : Download signer
432
- uses : actions/download-artifact@v3
433
- with :
434
- name : mithril-signer-${{ runner.os }}-${{ runner.arch }}
435
- path : ./build
436
-
437
- - name : Download client (${{ runner.os }}-${{ runner.arch }})
330
+ - name : Download built artifacts (${{ runner.os }}-${{ runner.arch }})
438
331
uses : actions/download-artifact@v3
439
332
with :
440
- name : mithril-client -${{ runner.os }}-${{ runner.arch }}
333
+ name : mithril-distribution -${{ runner.os }}-${{ runner.arch }}
441
334
path : ./build
442
335
443
- - name : Download client (macOS-X64)
336
+ - name : Download built artifacts (macOS-X64)
444
337
uses : actions/download-artifact@v3
445
338
with :
446
- name : mithril-client -macOS-X64
339
+ name : mithril-distribution -macOS-X64
447
340
path : ./build
448
341
449
- - name : Download client (Windows-X64)
342
+ - name : Download built artifacts (Windows-X64)
450
343
uses : actions/download-artifact@v3
451
344
with :
452
- name : mithril-client -Windows-X64
345
+ name : mithril-distribution -Windows-X64
453
346
path : ./build
454
347
455
348
- name : Update unstable release
349
+ if : github.ref == 'refs/heads/main'
456
350
uses : marvinpinto/action-automatic-releases@latest
457
351
with :
458
352
repo_token : ${{ secrets.GITHUB_TOKEN }}
@@ -501,6 +395,6 @@ jobs:
501
395
terraform plan -var "image_id=${{ env.BRANCH_NAME }}-${{ steps.slug.outputs.sha8 }}" -var 'private_key=${{ env.GCLOUD_PRIVATE_KEY }}' -var 'google_application_credentials_json=${{ env.GOOGLE_CREDENTIALS }}' -var 'genesis_secret_key=${{ env.GENESIS_SECRET_KEY }}'
502
396
503
397
- name : Terraform Apply
504
- if : github.ref == 'refs/heads/main' && github.event_name == 'push'
398
+ if : github.ref == 'refs/heads/main'
505
399
run : |
506
400
terraform apply -auto-approve -var "image_id=${{ env.BRANCH_NAME }}-${{ steps.slug.outputs.sha8 }}" -var 'private_key=${{ env.GCLOUD_PRIVATE_KEY }}' -var 'google_application_credentials_json=${{ env.GOOGLE_CREDENTIALS }}' -var 'genesis_secret_key=${{ env.GENESIS_SECRET_KEY }}'
0 commit comments