This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
811 lines (693 loc) · 27.2 KB
/
tests.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
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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
name: Tests
on:
pull_request:
push:
branches: [master]
workflow_call:
inputs:
rev:
description: Revision of SDK
required: true
type: string
continue-on-error:
required: false
default: false
type: boolean
# jobs:
prebuild:
required: false
default: true
type: boolean
source:
required: false
default: true
type: boolean
support-crates:
required: false
default: true
type: boolean
examples:
required: false
default: true
type: boolean
style:
required: false
default: true
type: boolean
clippy:
required: false
default: true
type: boolean
defaults:
run:
shell: bash
env:
RUSTUP_MAX_RETRIES: 10
CARGO_INCREMENTAL: 1
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
# for actions/cache@v3:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 6
FLIPPER_FW_SRC_PATH: ${{ github.workspace }}/fz_fw/
FLIPPER_REPO_CLONE_PATH: ${{ github.workspace }}/fz_fw/
jobs:
test-support-crates:
name: Test ${{ matrix.crate }} (${{ matrix.os.short }})
needs: [cfg, test-conditions]
if: fromJSON(needs.test-conditions.outputs.support-crates)[0]
runs-on: ${{ matrix.os.full }}
continue-on-error: ${{ inputs.continue-on-error || false }}
strategy:
fail-fast: false
matrix:
os:
- { full: macos-latest, short: macos }
- { full: ubuntu-latest, short: linux }
- { full: windows-latest, short: win }
crate: ${{ fromJSON(needs.test-conditions.outputs.support-crates) }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Rust toolchain
run: rustup show
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ needs.cfg.outputs.cargo-cache-paths }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}
restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Check
run: cargo check -p=${{ matrix.crate }}
- name: Test
run: cargo test -p=${{ matrix.crate }} --no-fail-fast
build-bindings-prebuilt:
name: Build ${{ matrix.crate }} [prebuilt] ${{ matrix.profile && 'R' || 'D' }} (${{ matrix.os.short }})
needs: [cfg, test-conditions]
if: fromJSON(needs.test-conditions.outputs.main-crates)[0]
runs-on: ${{ matrix.os.full }}
continue-on-error: ${{ inputs.continue-on-error || false }}
strategy:
fail-fast: true
matrix:
os:
- { full: macos-latest, short: macos }
- { full: ubuntu-latest, short: linux }
- { full: windows-latest, short: win }
crate: ${{ fromJSON(needs.test-conditions.outputs.main-crates) }}
profile:
- "" # debug
- --release
target:
- --target=thumbv7em-none-eabihf
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ needs.cfg.outputs.cargo-cache-paths }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}
restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Rust toolchain
run: rustup show
- name: Build
run: cargo build -p=${{ matrix.crate }} ${{ matrix.profile }} ${{ matrix.target }}
build-bindings-source:
name: Build bindings [${{ matrix.rev }}] ${{ matrix.profile && 'R' || 'D' }} (${{ matrix.os.short }})
needs: cfg
if: needs.cfg.outputs.mod-flipper0-sys-build || inputs.source
runs-on: ${{ matrix.os.full }}
continue-on-error: ${{ inputs.continue-on-error || false }}
strategy:
fail-fast: true
matrix:
os:
- { full: macos-latest, short: macos }
- { full: ubuntu-latest, short: linux }
- { full: windows-latest, short: win }
profile:
- "" # debug
- --release
target:
- thumbv7em-none-eabihf
rev:
- ${{ needs.cfg.outputs.def-sdk-ver }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ needs.cfg.outputs.cargo-cache-paths }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}
restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Rust toolchain
run: rustup show
- name: Cache SDK
uses: actions/cache@v3
id: cache-sdk
with:
path: ${{ env.FLIPPER_FW_SRC_PATH }}
key: f0-fw-${{ matrix.rev }}-${{ runner.os }}
- name: fix permissions
if: steps.cache-sdk.outputs.cache-hit == 'true' && runner.os != 'Windows'
run: chmod -R a+x ${{ env.FLIPPER_FW_SRC_PATH }}
- name: Checkout SDK
if: (steps.cache-sdk.outputs.cache-hit != 'true') || contains('release-candidate, dev', matrix.rev)
uses: actions/checkout@v3
with:
repository: flipperdevices/flipperzero-firmware
path: ${{ env.FLIPPER_FW_SRC_PATH }}
ref: ${{ matrix.rev }}
submodules: true
clean: false
- name: script .ext
if: runner.os == 'Windows'
run: echo "FBT_SHELL_EXT=.cmd" >> $GITHUB_ENV
# - name: Python
# uses: actions/setup-python@v4
# if: runner.os == 'Macos' && (steps.cache-sdk.outputs.cache-hit != 'true') || contains('release-candidate, dev', matrix.rev)
# with:
# python-version: '3.10'
- name: Setup SDK
if: (steps.cache-sdk.outputs.cache-hit != 'true') || contains('release-candidate, dev', matrix.rev)
run: |
cd $FLIPPER_FW_SRC_PATH
if [ ! -d toolchain ]; then
./fbt${{ env.FBT_SHELL_EXT || '' }}
fi
- name: Build flipper0-sys (no features)
run:
cargo build -p=flipper0-sys ${{ matrix.profile }} --target=${{ matrix.target }}
--no-default-features --features="use-local-sdk"
- name: Build flipper0-sys (min features)
run:
cargo build -p=flipper0-sys ${{ matrix.profile }} --target=${{ matrix.target }}
--no-default-features --features="use-local-sdk, panic, macro, allocator-global, oom-global"
- name: Build flipper0-sys (max features)
run:
cargo build -p=flipper0-sys ${{ matrix.profile }} --target=${{ matrix.target }}
--no-default-features --features="use-local-sdk, panic, macro, allocator-global, oom-global, derive-default, derive-eq, derive-copy, derive-hash, derive-ord, derive-partialeq, derive-partialord, derive-debug"
- name: Build flipper0 (no features)
if: ${{ runner.os != 'Windows' }}
run:
cargo build -p=flipper0 ${{ matrix.profile }} --target=${{ matrix.target }}
--no-default-features --features="use-local-sdk"
- name: Build flipper0 (min features)
if: ${{ runner.os != 'Windows' }}
run:
cargo build -p=flipper0 ${{ matrix.profile }} --target=${{ matrix.target }}
--no-default-features --features="use-local-sdk, panic, macro, allocator-global, oom-global"
- name: Build flipper0 (max features)
if: ${{ runner.os != 'Windows' }}
run:
cargo build -p=flipper0 ${{ matrix.profile }} --target=${{ matrix.target }}
--no-default-features --features="use-local-sdk, panic, macro, allocator-global, oom-global, derive-default, derive-eq, derive-copy, derive-hash, derive-ord, derive-partialeq, derive-partialord, derive-debug"
# TODO: conditional, split to faps/non-faps
build-example-crates:
name: Build E ${{ matrix.crate.name }} [${{ matrix.rev }}] ${{ matrix.profile && 'R' || 'D' }} (${{ matrix.os.short }})
needs: cfg
if: inputs.examples ||
needs.cfg.outputs.mod-examples ||
needs.cfg.outputs.mod-build-support ||
needs.cfg.outputs.mod-flipper0-any
runs-on: ${{ matrix.os.full }}
continue-on-error: ${{ inputs.continue-on-error || false }}
strategy:
fail-fast: false
matrix:
os:
- { full: macos-latest, short: macos }
- { full: ubuntu-latest, short: linux }
crate:
- { name: fap-manifest-metadata-example, fap: false }
- { name: fap-manifest-toml-example, fap: false }
- { name: fap-build-example, fap: true }
- { name: main-macro-example, fap: true }
- { name: fs-example, fap: true }
profile:
- --release
- ""
rev:
- ${{ needs.cfg.outputs.def-sdk-ver }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ needs.cfg.outputs.cargo-cache-paths }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}
restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Rust toolchain
run: rustup show
- name: Cache SDK
if: matrix.crate.fap
uses: actions/cache@v3
id: cache-sdk
with:
path: ${{ env.FLIPPER_FW_SRC_PATH }}
key: f0-fw-${{ matrix.rev }}-${{ runner.os }}
- name: fix permissions
if: matrix.crate.fap && steps.cache-sdk.outputs.cache-hit == 'true' && runner.os != 'Windows'
run: chmod -R a+x ${{ env.FLIPPER_FW_SRC_PATH }}
- name: Checkout SDK
if: matrix.crate.fap && ((steps.cache-sdk.outputs.cache-hit != 'true') || contains('release-candidate, dev', matrix.rev))
uses: actions/checkout@v3
with:
repository: flipperdevices/flipperzero-firmware
path: ${{ env.FLIPPER_FW_SRC_PATH }}
ref: ${{ matrix.rev }}
submodules: true
clean: false
- name: script .ext
if: matrix.crate.fap && (runner.os == 'Windows')
run: echo "FBT_SHELL_EXT=.cmd" >> $GITHUB_ENV
- name: Python
uses: actions/setup-python@v4
if: runner.os == 'Macos' && (steps.cache-sdk.outputs.cache-hit != 'true') || contains('release-candidate, dev', matrix.rev)
with:
python-version: '3.10'
- name: Setup SDK
if: matrix.crate.fap && ((steps.cache-sdk.outputs.cache-hit != 'true') || contains('release-candidate, dev', matrix.rev))
run: |
cd $FLIPPER_FW_SRC_PATH
if [ ! -d toolchain ]; then
./fbt${{ env.FBT_SHELL_EXT }}
fi
- name: Build
run: cargo build -p=${{ matrix.crate.name }} ${{ matrix.profile }} --target=thumbv7em-none-eabihf
# TODO: result | grep "error", then
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message
- name: FBT
if: matrix.crate.fap
run: |
cd $FLIPPER_FW_SRC_PATH
./fbt${{ env.FBT_SHELL_EXT }} fap_${{ matrix.crate.name }}
# COMPACT=${{ matrix.profile && 1 || 0 }} DEBUG=${{ matrix.profile && 0 || 1 }}
build-crates-examples:
name: Build E ${{ matrix.profile && 'R' || 'D' }} (${{ matrix.os.short }})
needs: [cfg, test-conditions]
if: inputs.examples ||
needs.cfg.outputs.mod-crates-examples ||
needs.cfg.test-conditions.flipper0-sys
runs-on: ${{ matrix.os.full }}
continue-on-error: ${{ inputs.continue-on-error || false }}
strategy:
fail-fast: false
matrix:
os:
- { full: macos-latest, short: macos }
- { full: ubuntu-latest, short: linux }
profile:
- "" # debug
- --release
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ needs.cfg.outputs.cargo-cache-paths }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}
restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Rust toolchain
run: rustup show
- name: Build
run: cargo build --all --examples ${{ matrix.profile }}
style:
name: Style
needs: cfg
if: needs.cfg.outputs.mod-any-src-rs || inputs.style
runs-on: ubuntu-latest
continue-on-error: ${{ inputs.continue-on-error || false }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ needs.cfg.outputs.cargo-cache-paths }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}
restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Check
run: cargo fmt --all -- --check
clippy:
name: Clippy [${{ matrix.rev }}]
needs: cfg
if: needs.cfg.outputs.mod-any-src-rs || inputs.clippy
runs-on: ubuntu-latest
continue-on-error: ${{ inputs.continue-on-error || false }}
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
rev:
- ${{ needs.cfg.outputs.def-sdk-ver }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
# SDK
- name: Cache SDK
uses: actions/cache@v3
id: cache-sdk
with:
path: ${{ env.FLIPPER_FW_SRC_PATH }}
key: f0-fw-${{ matrix.rev }}-${{ runner.os }}
- name: fix permissions
if: steps.cache-sdk.outputs.cache-hit == 'true'
run: chmod -R a+x ${{ env.FLIPPER_FW_SRC_PATH }}
- name: Checkout SDK
if: (steps.cache-sdk.outputs.cache-hit != 'true') || contains('release-candidate, dev', matrix.rev)
uses: actions/checkout@v3
with:
repository: flipperdevices/flipperzero-firmware
path: ${{ env.FLIPPER_FW_SRC_PATH }}
ref: ${{ matrix.rev }}
submodules: true
clean: false
- name: Setup SDK
if: (steps.cache-sdk.outputs.cache-hit != 'true') || contains('release-candidate, dev', matrix.rev)
run: |
cd $FLIPPER_FW_SRC_PATH
if [ ! -d toolchain ]; then
./fbt
fi
# Rust Toolchain
- name: Cache Cargo
uses: actions/cache@v3
with:
path: ${{ needs.cfg.outputs.cargo-cache-paths }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}+tools
restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Rust toolchain
run: rustup show
- name: Install Clippy
run: rustup component add clippy
- name: Install Tools
uses: taiki-e/[email protected]
with: { tool: "clippy-sarif,sarif-fmt,jset" }
continue-on-error: true
- name: Install Clippy Sarif
run: which clippy-sarif || cargo install clippy-sarif sarif-fmt
- name: Install Jset
run: which jset || cargo install jset
# Prepare
- name: Read Clippy Allow list
id: clippy-allow
uses: jbutcher5/[email protected]
with:
file: ${{ github.workspace }}/.github/clippy-allow.yml
key-path: '["allow"]'
- name: Read Clippy Warn list
id: clippy-warn
uses: jbutcher5/[email protected]
with:
file: ${{ github.workspace }}/.github/clippy-allow.yml
key-path: '["warn"]'
- name: Prepare Clippy Allow list
id: clippy-allow-args
run: echo "value=${{ format('-A clippy::{0}', join(fromJSON(steps.clippy-allow.outputs.data), ' -A clippy::')) }}" >> $GITHUB_OUTPUT
- name: Prepare Clippy Warn list
id: clippy-warn-args
run: echo "value=${{ format('-W clippy::{0}', join(fromJSON(steps.clippy-warn.outputs.data), ' -W clippy::')) }}" >> $GITHUB_OUTPUT
# Build
- name: Build Support Crates
run: cargo clippy --message-format=json
--all-features --all-targets
-p=fam
-p=flipper0-build-cfg
-p=flipper0-fam-build
-p=flipper0-fap-build
-p=flipper0-macro
--
${{ steps.clippy-allow-args.outputs.value }}
${{ steps.clippy-warn-args.outputs.value }} |
clippy-sarif | tee clippy-support-crates.sarif | sarif-fmt
continue-on-error: true
- name: Build Main Crates
run: cargo clippy --message-format=json
--all-features
-p=flipper0
-p=flipper0-sys
--
${{ steps.clippy-allow-args.outputs.value }}
${{ steps.clippy-warn-args.outputs.value }} |
clippy-sarif | tee clippy-main-crates.sarif | sarif-fmt
continue-on-error: true
- name: Build Example Crates
run: cargo clippy --message-format=json
--all-features --all-targets
-p=fap-manifest-metadata-example
-p=fap-manifest-toml-example
-p=fap-build-example
-p=main-macro-example
-p=fs-example
--
${{ steps.clippy-allow-args.outputs.value }}
${{ steps.clippy-warn-args.outputs.value }} |
clippy-sarif | tee clippy-example-crates.sarif | sarif-fmt
continue-on-error: true
# Results
- name: Merge Results
run: jset union ./*.sarif > ./clippy-all.sarif
- name: Upload
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: clippy-all.sarif
wait-for-processing: true
- name: Clean Results
# For not to put it in the cache:
run: rm ./*.sarif
cfg:
name: 🛠 Config
runs-on: ubuntu-latest
continue-on-error: ${{ inputs.continue-on-error || false }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# default and minimal fetch-depth is 10:
fetch-depth: ${{ (github.event.pull_request.commits == 1 && 10) || github.event.pull_request.commits || 10 }}
- name: inputs overrides (${{ steps.inputs.outputs.exist || 'no' }})
id: inputs
if: inputs
run: echo "exist=${{ contains(toJSON(inputs), ':') || '' }}" >> $GITHUB_OUTPUT
- id: ci
name: ci
uses: boozook/has-changed-path@master
with:
paths: .github/
- id: examples
name: examples
if: (!steps.inputs.outputs.exist)
uses: boozook/has-changed-path@master
with:
paths: examples/**/*
- id: crates-examples
name: crates-examples
if: (!steps.inputs.outputs.exist)
uses: boozook/has-changed-path@master
with:
paths: examples/*.rs
- id: build-support
name: build-support
if: (!steps.inputs.outputs.exist)
uses: boozook/has-changed-path@master
with:
paths: build/
- id: fam-build
name: fam-build
uses: boozook/has-changed-path@master
if: steps.build-support.outputs.changed == 'true'
with:
paths: build/fam-build
- id: fap-build
name: fap-build
uses: boozook/has-changed-path@master
if: steps.build-support.outputs.changed == 'true'
with:
paths: build/fap-build
- id: proc-macro
name: proc-macro
uses: boozook/has-changed-path@master
if: steps.build-support.outputs.changed == 'true'
with:
paths: build/proc-macro
- id: common
name: common
uses: boozook/has-changed-path@master
if: steps.build-support.outputs.changed == 'true'
with:
paths: build/common
- id: fam
name: fam
if: (!steps.inputs.outputs.exist)
uses: boozook/has-changed-path@master
with:
paths: format/fam
- id: flipper0
name: flipper0
if: (!steps.inputs.outputs.exist)
uses: boozook/has-changed-path@master
with:
paths: flipper/
- id: flipper0-sys
name: flipper0-sys
if: (!steps.inputs.outputs.exist)
uses: boozook/has-changed-path@master
with:
paths: src/ Cargo.toml
- id: flipper0-sys-build
name: flipper0-sys-build
if: (!steps.inputs.outputs.exist)
uses: boozook/has-changed-path@master
with:
paths: src/build/
- id: gen
name: gen
if: (!steps.inputs.outputs.exist)
uses: boozook/has-changed-path@master
with:
paths: gen/
- id: gen-api-ver
name: gen-api-ver
uses: boozook/has-changed-path@master
if: steps.gen.outputs.changed == 'true'
with:
paths: gen/API-VERSION
- id: any-src-rs
name: any-src-rs
if: (!steps.inputs.outputs.exist)
uses: boozook/has-changed-path@master
with:
paths: "**/*.rs"
- id: gen-api-ver-file
name: gen-api-ver-file
run: echo "value=$(cat gen/API-VERSION || '')" >> $GITHUB_OUTPUT
- id: gen-sdk-ver-file
name: gen-sdk-ver-file
run: echo "value=$(cat gen/SDK-VERSION || '')" >> $GITHUB_OUTPUT
# Is it a push to master or a call from another workflow?
# For both of this options we should test all of things, anyway.
- id: anyway
name: is push to master
if: (!steps.inputs.outputs.exist)
run: echo "value=${{
(github.event_name == 'push' && github.ref_name == 'master') ||
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) || '' }}" >> $GITHUB_OUTPUT
outputs:
cargo-cache-paths: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
# minimal supported version:
def-sdk-ver: ${{ inputs.rev || steps.gen-sdk-ver-file.outputs.value || '0.70.1' }}
def-api-ver: ${{ steps.gen-api-ver-file.outputs.value || '7.0' }}
# changes:
mod-fam: ${{ steps.fam.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-flipper0-build-common: ${{ steps.common.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-flipper0-fam-build: ${{ steps.fam-build.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-flipper0-fap-build: ${{ steps.fap-build.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-flipper0-macro: ${{ steps.proc-macro.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-flipper0-any: ${{ steps.flipper0-sys.outputs.changed == 'true' || steps.flipper0.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-flipper0-sys: ${{ steps.flipper0-sys.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-flipper0-sys-build: ${{ steps.flipper0-sys-build.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-flipper0: ${{ steps.flipper0.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-examples: ${{ steps.examples.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-crates-examples: ${{ steps.crates-examples.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-ci: ${{ steps.ci.outputs.changed == 'true' || '' }}
mod-build-support: ${{ steps.build-support.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-gen: ${{ steps.gen.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-api-ver: ${{ steps.gen-api-ver.outputs.changed == 'true' || steps.anyway.outputs.value }}
mod-any-src-rs: ${{ steps.any-src-rs.outputs.changed == 'true' || steps.anyway.outputs.value }}
test-conditions:
name: 🛠 Conditional Decisions
needs: cfg
runs-on: ubuntu-latest
continue-on-error: ${{ inputs.continue-on-error || false }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
# TODO: build deps-graph just by `cargo metadata` + handy additions such as `gen/`.
- id: support-crates-matrix-list
run: >-
echo value=[
${{ inputs.support-crates || needs.cfg.outputs.mod-fam && '\"fam\",' || '' }}
${{ inputs.support-crates || needs.cfg.outputs.mod-flipper0-build-common && '\"flipper0-build-cfg\",' || '' }}
${{ (inputs.support-crates || needs.cfg.outputs.mod-flipper0-fam-build || needs.cfg.outputs.mod-fam) && '\"flipper0-fam-build\",' || '' }}
${{
inputs.support-crates ||
( needs.cfg.outputs.mod-flipper0-fap-build
|| needs.cfg.outputs.mod-flipper0-build-common
|| (needs.cfg.outputs.mod-flipper0-fam-build || needs.cfg.outputs.mod-fam)
) && '\"flipper0-fap-build\",' || '' }}
${{
inputs.support-crates ||
( needs.cfg.outputs.mod-flipper0-macro
|| (needs.cfg.outputs.mod-flipper0-fam-build || needs.cfg.outputs.mod-fam)
) && '\"flipper0-macro\",' || '' }}
] >> $GITHUB_OUTPUT
- id: main-crates-matrix-list
run: >-
echo value=[
${{
inputs.prebuild ||
( needs.cfg.outputs.mod-flipper0-sys
|| needs.cfg.outputs.mod-flipper0-build-common
|| needs.cfg.outputs.mod-flipper0-macro
|| needs.cfg.outputs.mod-fam
|| needs.cfg.outputs.mod-gen
) && '\"flipper0-sys\",' || '' }}
${{
inputs.prebuild ||
( needs.cfg.outputs.mod-flipper0
|| needs.cfg.outputs.mod-flipper0-sys
|| needs.cfg.outputs.mod-flipper0-build-common
|| needs.cfg.outputs.mod-flipper0-macro
|| needs.cfg.outputs.mod-fam
|| needs.cfg.outputs.mod-gen
) && '\"flipper0\",' || '' }}
] >> $GITHUB_OUTPUT
# decisions, should we test these things:
outputs:
support-crates: ${{ steps.support-crates-matrix-list.outputs.value }}
main-crates: ${{ steps.main-crates-matrix-list.outputs.value }}
flipper0-sys: >-
${{
inputs.prebuild ||
needs.cfg.outputs.mod-flipper0-sys
|| needs.cfg.outputs.mod-flipper0-build-common
|| needs.cfg.outputs.mod-flipper0-macro
|| needs.cfg.outputs.mod-fam
|| needs.cfg.outputs.mod-gen
|| ''
}}
flipper0: >-
${{
inputs.prebuild ||
needs.cfg.outputs.mod-flipper0
|| needs.cfg.outputs.mod-flipper0-sys
|| needs.cfg.outputs.mod-flipper0-build-common
|| needs.cfg.outputs.mod-flipper0-macro
|| needs.cfg.outputs.mod-fam
|| needs.cfg.outputs.mod-gen
|| ''
}}
# # only for debug purposes:
# cfg-view:
# name: 🛠 View
# needs: [cfg, test-conditions]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
# - name: Config
# run: echo '${{ toJSON( needs.cfg.outputs ) }}'
# - name: Conditions
# run: echo '${{ toJSON( needs.test-conditions.outputs ) }}'