-
-
Notifications
You must be signed in to change notification settings - Fork 75
1740 lines (1521 loc) · 60.9 KB
/
ci.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
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: CI
on:
pull_request:
push:
branches:
- main
schedule:
- cron: '17 7 * * 1-5' # run once per day Monday-Friday at 7:17am
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_TERM_VERBOSE: 'true'
jobs:
ci-everything:
name: All CI stages
runs-on: ubuntu-latest
needs:
- lint
- rust-tests
- cross-version-caching
- cross-feature-caching
- run-on-rust-libp2p
- run-on-libp2p-dcutr-relay
- run-on-libp2p-gossipsub-request-response
- run-on-libp2p-uds
- run-on-core-graphics
- run-on-bevy-core
- run-on-bevy-gltf
- run-on-clap
- run-on-sqllogictest
- run-on-ref-slice-fork
- run-on-ref-slice-fork-windows
- run-on-tokio-explicit
- run-on-tokio-implicit
- run-on-perf-event-open-sys2
- fails-on-too-old-rustc
if: ${{ success() || failure() }} # Run this job even if a dependency has failed.
steps:
- name: Job outcomes
run: |
echo "lint: ${{ needs.lint.result }}"
echo "rust-tests: ${{ needs.rust-tests.result }}"
echo "cross-version-caching: ${{ needs.cross-version-caching.result }}"
echo "cross-feature-caching: ${{ needs.cross-feature-caching.result }}"
echo "run-on-rust-libp2p: ${{ needs.run-on-rust-libp2p.result }}"
echo "run-on-libp2p-dcutr-relay: ${{ needs.run-on-libp2p-dcutr-relay.result }}"
echo "run-on-libp2p-gossipsub-request-response: ${{ needs.run-on-libp2p-gossipsub-request-response.result }}"
echo "run-on-libp2p-uds: ${{ needs.run-on-libp2p-uds.result }}"
echo "run-on-core-graphics: ${{ needs.run-on-core-graphics.result }}"
echo "run-on-bevy-core: ${{ needs.run-on-bevy-core.result }}"
echo "run-on-bevy-gltf: ${{ needs.run-on-bevy-gltf.result }}"
echo "run-on-clap: ${{ needs.run-on-clap.result }}"
echo "run-on-sqllogictest: ${{ needs.run-on-sqllogictest.result }}"
echo "run-on-ref-slice-fork: ${{ needs.run-on-ref-slice-fork.result }}"
echo "run-on-ref-slice-fork-windows: ${{ needs.run-on-ref-slice-fork-windows.result }}"
echo "run-on-tokio-explicit: ${{ needs.run-on-tokio-explicit.result }}"
echo "run-on-tokio-implicit: ${{ needs.run-on-tokio-implicit.result }}"
echo "run-on-perf-event-open-sys2: ${{ needs.run-on-perf-event-open-sys2.result }}"
echo "fails-on-too-old-rustc: ${{ needs.fails-on-too-old-rustc.result }}"
# Fail this required job if any of its dependent jobs have failed.
#
# Do not attempt to consolidate these steps into one step, it won't work.
# Multi-line `if` clauses are not evaluated properly: see the intermediate commits in
# https://github.com/obi1kenobi/cargo-semver-checks/pull/405
- if: ${{ needs.lint.result != 'success' }}
run: exit 1
- if: ${{ needs.rust-tests.result != 'success' }}
run: exit 1
- if: ${{ needs.cross-version-caching.result != 'success' }}
run: exit 1
- if: ${{ needs.cross-feature-caching.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-rust-libp2p.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-libp2p-dcutr-relay.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-libp2p-gossipsub-request-response.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-libp2p-uds.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-core-graphics.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-bevy-core.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-bevy-gltf.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-clap.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-sqllogictest.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-ref-slice-fork.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-ref-slice-fork-windows.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-tokio-explicit.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-tokio-implicit.result != 'success' }}
run: exit 1
- if: ${{ needs.run-on-perf-event-open-sys2.result != 'success' }}
run: exit 1
- if: ${{ needs.fails-on-too-old-rustc.result != 'success' }}
run: exit 1
lint:
name: Check lint and rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
cache: false
rustflags: ""
- uses: Swatinem/rust-cache@v2
with:
workspaces: 'semver'
- name: cargo clippy
run: cargo clippy --manifest-path semver/Cargo.toml --workspace --all-features --all-targets --no-deps -- -D warnings --allow deprecated
- name: cargo fmt
run: cargo fmt --manifest-path semver/Cargo.toml -- --check
- name: cargo doc
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --manifest-path semver/Cargo.toml --workspace --all-features --no-deps --document-private-items
rust-tests:
name: Run tests
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
# IMPORTANT: When updating the versions here, make sure you also update
# the `fails-on-too-old-rustc` job and its error message to
# to account for the raised minimum required version.
toolchain: ["1.71", "1.72", "1.73", "stable", "beta"]
experimental: [false]
include:
- toolchain: "nightly"
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Install rust
id: toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
rustflags: ""
cache: false
- name: restore test rustdocs
id: cache-test-rustdocs
uses: actions/cache@v3
with:
path: semver/localdata/test_data/
key: test-rustdocs-${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/test_crates/**/*.rs') }}
- name: Regenerate test data
if: steps.cache-test-rustdocs.outputs.cache-hit != 'true'
run: |
cd semver
./scripts/regenerate_test_rustdocs.sh +${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: 'semver'
- name: compile
run: |
cd semver
cargo test --no-run
- name: test
run: |
cd semver
cargo test
build-binary:
name: Build binary
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
cache: false
- uses: Swatinem/rust-cache@v2
with:
workspaces: 'semver'
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.3
- name: build and cache
run: |
cd semver
sccache --zero-stats
cargo build
sccache --show-stats
mkdir ../bins
mv target/debug/cargo-semver-checks ../bins/cargo-semver-checks
- name: cache binary
uses: actions/cache/save@v3
with:
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
build-binary-windows:
# It could be easily combined into a single job with build-binary using the
# matrix strategy, but it is not a good idea. Building the tool on Windows
# is much slower and if the matrix strategy is used, there is currently no
# supported by GitHub Actions way to depend only on a single case. It means
# all semver checks below would have to wait before both binaries are built,
# which would make whole CI last longer.
name: Build binary (Windows)
runs-on: windows-latest
env:
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
cache: false
- uses: Swatinem/rust-cache@v2
with:
workspaces: 'semver'
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.3
- name: build and cache
run: |
cd semver
sccache --zero-stats
cargo build
sccache --show-stats
mkdir ..\bins
mv target\debug\cargo-semver-checks.exe ..\bins\cargo-semver-checks.exe
- name: cache binary
uses: actions/cache/save@v3
with:
path: bins\
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
cross-version-caching:
# Ensure that cached rustdoc JSON files from an mismatched rustdoc version
# are transparently cleared and overwritten with the rustdoc version from the current toolchain.
# Fixes: https://github.com/obi1kenobi/cargo-semver-checks/issues/415
name: 'Caching across rustdoc versions'
runs-on: ubuntu-latest
needs:
- build-binary
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Checkout rust-libp2p
uses: actions/checkout@v4
with:
persist-credentials: false
repository: 'libp2p/rust-libp2p'
ref: '3371d7ceab242440216ae9ab99829631fa418f3b'
path: 'subject'
# rust-libp2p requires protobuf-compiler.
- name: Install protobuf-compiler
run: sudo apt install protobuf-compiler
- name: Restore binary
id: cache-binary
uses: actions/cache/restore@v3
with:
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Install rust
id: toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "1.73" # Rust 1.73 uses rustdoc v26
rustflags: ""
cache: false
- name: Restore rustdoc
id: cache
uses: actions/cache/restore@v3
with:
key: cross-version-caching-${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
- name: Restore cargo index and rustdoc target dir
uses: Swatinem/rust-cache@v2
with:
workspaces: |
subject/target/semver-checks/local-libp2p_core-0_37_0
# If we failed to set up the cache, set it up now.
- name: Run semver-checks
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/core/Cargo.toml" --verbose
- name: Save rustdoc
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
key: cross-version-caching-${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
- name: Install newer rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# Make sure this version matches the env var below.
toolchain: "nightly" # Rust 1.75-nightly uses rustdoc v27
rustflags: ""
cache: false
- name: Check with older rustdoc version cached
env:
NEWER_RUST_VERSION: "nightly" # Make sure this matches the version installed just above.
run: |
# Use a separate workspace, to avoid contaminating the cache for Swatinem/rust-cache@v2
cp -R subject subject-new
# Show what's in the cache.
ls subject-new/target/semver-checks/cache/
# Ensure the previous cached rustdoc file still exists.
[ -f "subject-new/target/semver-checks/cache/registry-libp2p_core-0_37_0.json" ] || { \
echo "could not find libp2p-core cache file"; \
exit 1;
}
export OLD_RUSTDOC_VERSION="$(jq .format_version subject-new/target/semver-checks/cache/registry-libp2p_core-0_37_0.json)"
# Run cargo-semver-checks with the older cached file.
# In a prior step, we installed a newer Rust, so we'll set that as the default
# for cargo-semver-checks to invoke here.
rustup override set "$NEWER_RUST_VERSION"
bins/cargo-semver-checks semver-checks check-release --manifest-path="subject-new/core/Cargo.toml" --verbose
export NEW_RUSTDOC_VERSION="$(jq .format_version subject-new/target/semver-checks/cache/registry-libp2p_core-0_37_0.json)"
# Ensure the cached rustdoc versions were indeed different before and after.
set -x
[ "$OLD_RUSTDOC_VERSION" != "$NEW_RUSTDOC_VERSION" ] || exit 1
cross-feature-caching:
# Ensure that cached rustdoc JSON files created with mismatched feature config is not used.
name: 'Caching with feature config changed'
runs-on: ubuntu-latest
needs:
- build-binary
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
# This is a fork of serde, modified to make feature `unstable` break semver.
- name: Checkout fork of serde
uses: actions/checkout@v4
with:
persist-credentials: false
repository: 'staniewzki/serde'
ref: 'c479da812fd421260667c02049e6d11edd82c2dc'
path: 'subject'
- name: Restore binary
id: cache-binary
uses: actions/cache/restore@v3
with:
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Install rust
id: toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
rustflags: ""
- name: Restore rustdoc
id: cache
uses: actions/cache/restore@v3
with:
key: cross-feature-caching-${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
- name: Restore cargo index and rustdoc target dir
uses: Swatinem/rust-cache@v2
with:
workspaces: |
subject/target/semver-checks/local-serde-1_0_162
# Run even if there was a cache hit, to make sure the check passes.
- name: Run semver-checks
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/serde/Cargo.toml" --verbose
# Run cargo-semver-checks, enabling feature `unstable` this time.
# We expect this to fail.
# This run must not use the `serde` rustdoc without this feature as a baseline.
# If that happens, this check will unexpectedly pass -- and the test will fail.
- name: Check with rustdoc for mismatching feature config cached
continue-on-error: true
run: |
cd semver
set -euo pipefail
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/serde/Cargo.toml" --verbose --features unstable | tee output
touch unexpectedly_did_not_fail
- name: Check whether it failed
run: |
cd semver
if [ -f unexpectedly_did_not_fail ]; then exit 1; else exit 0; fi
- name: Check output
run: |
cd semver
EXPECTED="$(echo -e "--- failure struct_missing: pub struct removed or renamed ---")"
RESULT="$(cat output | grep failure)"
diff <(echo "$RESULT") <(echo "$EXPECTED")
- name: Verify cached rustdoc's hash
run: |
if [ -f subject/target/semver-checks/cache/registry-serde-1_0_162-f0dcb72a80405fd6.json ]; then exit 0; else exit 1; fi
- name: Cleanup
run: |
cd semver
rm output
rm -f unexpectedly_did_not_fail
- name: Save rustdoc
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
key: cross-feature-caching-${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
run-on-rust-libp2p:
# Run cargo-semver-checks on a crate with no semver violations,
# to make sure there are no false-positives.
#
# cargo-semver-checks previously reported a false-positive here,
# since an enum variant in the crate was included by a feature:
# https://github.com/obi1kenobi/cargo-semver-checks/issues/147
name: 'Semver: libp2p-core 0.37.0'
runs-on: ubuntu-latest
needs:
- build-binary
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Checkout rust-libp2p
uses: actions/checkout@v4
with:
persist-credentials: false
repository: 'libp2p/rust-libp2p'
ref: '3371d7ceab242440216ae9ab99829631fa418f3b'
path: 'subject'
- name: Install rust
id: toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
rustflags: ""
# rust-libp2p requires protobuf-compiler.
- name: Install protobuf-compiler
run: sudo apt install protobuf-compiler
- name: Restore binary
id: cache-binary
uses: actions/cache/restore@v3
with:
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Restore rustdoc
id: cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
- name: Restore cargo index and rustdoc target dir
uses: Swatinem/rust-cache@v2
with:
workspaces: |
subject/target/semver-checks/local-libp2p_core-0_37_0
- name: Run semver-checks
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/core/Cargo.toml" --verbose
# Test passing package name explicitly.
# It was previously possible to make the command above work while the one here failed.
# Reference: https://github.com/obi1kenobi/cargo-semver-checks/issues/174
- name: Run semver-checks (alternative command)
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/core/Cargo.toml" --package="libp2p-core" --verbose
- name: Save rustdoc
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
run-on-libp2p-dcutr-relay:
# Run cargo-semver-checks on a crate with no semver violations,
# to make sure there are no false-positives.
#
# cargo-semver-checks previously reported false-positives here
# due to renaming re-exports causing confusion about which types match each other:
# https://github.com/obi1kenobi/cargo-semver-checks/issues/202
# https://github.com/libp2p/rust-libp2p/pull/2647#issuecomment-1340254920
name: 'Semver: libp2p-dcutr 1.62.0 and libp2p-relay 0.14.0'
runs-on: ubuntu-latest
needs:
- build-binary
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Checkout rust-libp2p
uses: actions/checkout@v4
with:
persist-credentials: false
repository: 'libp2p/rust-libp2p'
ref: 'be0b62a78fe9d72811b9eda742137cc8ddc4da35'
path: 'subject'
- name: Install rust
id: toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
rustflags: ""
# rust-libp2p requires protobuf-compiler.
- name: Install protobuf-compiler
run: sudo apt install protobuf-compiler
- name: Restore binary
id: cache-binary
uses: actions/cache/restore@v3
with:
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Restore rustdoc
id: cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
- name: Restore cargo index and rustdoc target dir
uses: Swatinem/rust-cache@v2
with:
workspaces: |
subject/target/semver-checks/local-libp2p_dcutr-1_62_0
subject/target/semver-checks/local-libp2p_relay-0_14_0
- name: Run semver-checks on libp2p-dcutr
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/protocols/dcutr/Cargo.toml" --verbose
- name: Run semver-checks on libp2p-relay
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/protocols/relay/Cargo.toml" --verbose
- name: Save rustdoc
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
run-on-libp2p-gossipsub-request-response:
# Run cargo-semver-checks on two crates that used to trip an assert and cause a crash,
# due to re-exports that omit generic parameters because the underlying generic type supplies
# default values for those generics.
# https://github.com/libp2p/rust-libp2p/pull/3401#issuecomment-1409381365
name: 'Semver: libp2p-gossipsub ~0.44.0 + libp2p-request-response ~0.24.0'
runs-on: ubuntu-latest
needs:
- build-binary
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Checkout rust-libp2p
uses: actions/checkout@v4
with:
persist-credentials: false
repository: 'libp2p/rust-libp2p'
ref: '8b8dc26e0601433f5675430b29b50687a37d4cd8'
path: 'subject'
- name: Install rust
id: toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
rustflags: ""
# rust-libp2p requires protobuf-compiler.
- name: Install protobuf-compiler
run: sudo apt install protobuf-compiler
- name: Restore binary
id: cache-binary
uses: actions/cache/restore@v3
with:
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Restore rustdoc
id: cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
- name: Restore cargo index and rustdoc target dir
uses: Swatinem/rust-cache@v2
with:
workspaces: |
subject/target/semver-checks/local-libp2p_gossipsub-0_44_0
subject/target/semver-checks/local-libp2p_request_response-0_23_0
- name: Run semver-checks on libp2p-gossipsub
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/protocols/gossipsub/Cargo.toml" --baseline-version 0.43.0 --verbose
- name: Run semver-checks on libp2p-request-response
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/protocols/request-response/Cargo.toml" --baseline-version 0.23.0 --verbose
- name: Save rustdoc
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
run-on-libp2p-uds:
# Run cargo-semver-checks on a crate that has dependencies in a custom target
# https://github.com/obi1kenobi/cargo-semver-checks/issues/369
name: 'Semver: libp2p-uds 0.37.0'
runs-on: ubuntu-latest
needs:
- build-binary
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Checkout rust-libp2p
uses: actions/checkout@v4
with:
persist-credentials: false
repository: 'libp2p/rust-libp2p'
ref: '5b4eab7bafe6cba8fea6c806027ea680662b7cc6'
path: 'subject'
- name: Install rust
id: toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
rustflags: ""
# rust-libp2p requires protobuf-compiler.
- name: Install protobuf-compiler
run: sudo apt install protobuf-compiler
- name: Restore binary
id: cache-binary
uses: actions/cache/restore@v3
with:
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Restore rustdoc
id: cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
- name: Restore cargo index and rustdoc target dir
uses: Swatinem/rust-cache@v2
with:
workspaces: |
subject/target/semver-checks/local-libp2p_uds-0_37_0
- name: Run semver-checks on libp2p-uds
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/transports/uds/Cargo.toml" --verbose
- name: Save rustdoc
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
run-on-core-graphics:
# Run cargo-semver-checks on a crate with no semver violations,
# to make sure there are no false-positives.
#
# cargo-semver-checks previously reported a false-positive here,
# due to multiple methods by the same name being defined on the same type.
# https://github.com/obi1kenobi/cargo-semver-checks/issues/193
name: 'Semver: core-graphics'
runs-on: macos-latest
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Checkout rust-libp2p
uses: actions/checkout@v4
with:
persist-credentials: false
repository: 'servo/core-foundation-rs'
ref: '786895643140fa0ee4f913d7b4aeb0c4626b2085'
path: 'subject'
- name: Install rust
id: toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
rustflags: ""
# This job runs on macOS, not Linux like the rest.
# It should save its cache, because no other job will save it in its place.
- uses: Swatinem/rust-cache@v2
with:
shared-key: 'semver'
workspaces: |
semver
subject/target/semver-checks/local-core_graphics-0_22_3
- name: Restore rustdoc
id: cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
- name: Run semver-checks
run: |
cd semver
cargo run semver-checks check-release --manifest-path="../subject/core-graphics/Cargo.toml" --verbose
- name: Save rustdoc
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
run-on-bevy-core:
# cargo-semver-checks previously crashed here due to
# a bug in the generated Cargo.toml when generating a registry baseline:
# https://github.com/obi1kenobi/cargo-semver-checks/issues/261
name: 'Semver: bevy_core v0.9.0'
runs-on: ubuntu-latest
needs:
- build-binary
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Checkout bevy
uses: actions/checkout@v4
with:
persist-credentials: false
repository: 'bevyengine/bevy'
ref: 'v0.9.0'
path: 'subject'
- name: Install rust
id: toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
rustflags: ""
- name: Restore binary
id: cache-binary
uses: actions/cache/restore@v3
with:
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Restore rustdoc
id: cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
- name: Restore cargo index and rustdoc target dir
uses: Swatinem/rust-cache@v2
with:
workspaces: |
subject/target/semver-checks/local-bevy_core-0_9_0
- name: Run semver-checks
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/crates/bevy_core/Cargo.toml" --verbose
- name: Save rustdoc
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
run-on-bevy-gltf:
# cargo-semver-checks reported false-positives since it did not include
# features defined implicitly via optional dependencies:
# https://github.com/obi1kenobi/cargo-semver-checks/issues/265
name: 'Semver: bevy_gltf v0.9.1'
runs-on: ubuntu-latest
needs:
- build-binary
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Checkout bevy
uses: actions/checkout@v4
with:
persist-credentials: false
repository: 'bevyengine/bevy'
ref: 'v0.9.1'
path: 'subject'
- name: Install rust
id: toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
rustflags: ""
- name: Restore binary
id: cache-binary
uses: actions/cache/restore@v3
with:
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Restore rustdoc
id: cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
- name: Restore cargo index and rustdoc target dir
uses: Swatinem/rust-cache@v2
with:
workspaces: |
subject/target/semver-checks/local-bevy_gltf-0_9_1
- name: Run semver-checks
run: |
cd semver
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/crates/bevy_gltf/Cargo.toml" --baseline-version 0.9.0 --verbose
- name: Save rustdoc
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
path: subject/target/semver-checks/cache
run-on-sqllogictest:
# cargo-semver-checks failed to run here due to workspace manifest-parsing issues:
# https://github.com/obi1kenobi/cargo-semver-checks/issues/370
name: 'Semver: sqllogictest v0.13.0'
runs-on: ubuntu-latest
needs:
- build-binary
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v4
with:
persist-credentials: false
path: 'semver'
- name: Checkout sqllogictest
uses: actions/checkout@v4
with:
persist-credentials: false
repository: 'risinglightdb/sqllogictest-rs'
ref: 'v0.13.0'
path: 'subject'