-
-
Notifications
You must be signed in to change notification settings - Fork 78
1919 lines (1682 loc) · 68.7 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-libp2p-whose-dependency-has-warnings
- 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-libp2p-whose-dependency-has-warnings: ${{ needs.run-on-libp2p-whose-dependency-has-warnings.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-libp2p-whose-dependency-has-warnings.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'
# Ensure we include all new non-default features here explicitly, except for
# pass-through mutually-exclusive features from our dependencies such as:
# https://github.com/obi1kenobi/cargo-semver-checks/pull/824
#
# Ideally, one day we'd be able to do something like "`--all-features` except feature X":
# https://github.com/rust-lang/cargo/issues/3126
- name: cargo clippy
run: cargo clippy --manifest-path semver/Cargo.toml --workspace --all-targets --no-deps -- -D warnings --allow deprecated
- name: cargo fmt
run: cargo fmt --manifest-path semver/Cargo.toml -- --check
# Ensure we include all new non-default features here explicitly, except for
# pass-through mutually-exclusive features from our dependencies such as:
# https://github.com/obi1kenobi/cargo-semver-checks/pull/824
#
# Ideally, one day we'd be able to do something like "`--all-features` except feature X":
# https://github.com/rust-lang/cargo/issues/3126
- name: cargo doc
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --manifest-path semver/Cargo.toml --workspace --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.
#
# Also make sure to update the MSRV in the cargo-semver-checks-action CI:
# https://github.com/obi1kenobi/cargo-semver-checks-action/blob/main/.github/workflows/test-action.yml#L18
toolchain: ["1.81", "1.82", "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@v4
with:
path: semver/localdata/test_data/
key: test-rustdocs-and-meta-${{ 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/[email protected]
- 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@v4
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/[email protected]
- 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@v4
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
env:
OLDER_RUST: "1.81" # Rust 1.81 uses rustdoc v32
NEWER_RUST: "1.82" # Rust 1.82 uses rustdoc v33
steps:
- name: Put env vars in outputs
id: vars
run: |
echo "older-rust=$OLDER_RUST" >> $GITHUB_OUTPUT
echo "newer-rust=$NEWER_RUST" >> $GITHUB_OUTPUT
- 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@v4
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: ${{ steps.vars.outputs.older-rust }}
rustflags: ""
cache: false
- name: Restore rustdoc
id: cache
uses: actions/cache/restore@v4
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@v4
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:
toolchain: ${{ steps.vars.outputs.newer-rust }}
rustflags: ""
cache: false
- name: Check with older rustdoc version cached
run: |
# Echo commands to make debugging this script easier.
set -x
# 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/
EXPECTED_PREFIX='subject-new/target/semver-checks/cache/libp2p_core-0_37_0-ccce455725cbab73'
EXPECTED_CACHED_METADATA="${EXPECTED_PREFIX}.metadata.json"
EXPECTED_CACHED_RUSTDOC="${EXPECTED_PREFIX}.json"
# Ensure the previous cached rustdoc and metadata files still exist.
[ -f "$EXPECTED_CACHED_METADATA" ] || { \
echo "could not find libp2p-core metadata cache file"; \
exit 1;
}
[ -f "$EXPECTED_CACHED_RUSTDOC" ] || { \
echo "could not find libp2p-core rustdoc cache file"; \
exit 1;
}
export OLD_RUSTDOC_VERSION="$(jq .format_version "$EXPECTED_CACHED_RUSTDOC")"
# 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"
bins/cargo-semver-checks semver-checks check-release --manifest-path="subject-new/core/Cargo.toml" --verbose
# Show what's in the cache now.
ls subject-new/target/semver-checks/cache/
export NEW_RUSTDOC_VERSION="$(jq .format_version "$EXPECTED_CACHED_RUSTDOC")"
# Ensure the cached rustdoc versions were indeed different before and after.
[ "$OLD_RUSTDOC_VERSION" != "$NEW_RUSTDOC_VERSION" ] || exit 1
cross-feature-caching:
# Ensure that cached rustdoc JSON files created with mismatched feature config are 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@v4
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@v4
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: |
bins/cargo-semver-checks semver-checks check-release --manifest-path="subject/serde/Cargo.toml" --verbose
# Show what's in the cache.
ls subject/target/semver-checks/cache/
# Save the older rustdoc on cache miss. This must run *before* the cross-feature check,
# since we don't want to save that rustdoc -- we're making sure it gets generated and used!
- name: Save rustdoc
uses: actions/cache/save@v4
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 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: |
# Show what's in the cache.
ls subject/target/semver-checks/cache/
# The previous cached rustdoc should continue to exist.
PREVIOUS_PREFIX='subject/target/semver-checks/cache/serde-1_0_162-5900ebf8bb9b9f8b'
PREVIOUS_RUSTDOC="${PREVIOUS_PREFIX}.json"
PREVIOUS_METADATA="${PREVIOUS_PREFIX}.metadata.json"
if [ ! -f "$PREVIOUS_RUSTDOC" ]; then
echo "Older rustdoc JSON not found in cache!"
exit 1
fi
if [ ! -f "$PREVIOUS_METADATA" ]; then
echo "Older metadata file not found in cache!"
exit 1
fi
# There should also be a new cached rustdoc file for the new feature settings.
NEW_PREFIX='subject/target/semver-checks/cache/serde-1_0_162-6999ae87ca463ab3'
NEW_RUSTDOC="${NEW_PREFIX}.json"
NEW_METADATA="${NEW_PREFIX}.metadata.json"
if [ ! -f "$NEW_RUSTDOC" ]; then
echo "New rustdoc JSON for new feature combo not found in cache!"
exit 1
fi
if [ ! -f "$NEW_METADATA" ]; then
echo "New metadata file for new feature combo not found in cache!"
exit 1
fi
- name: Cleanup
run: |
cd semver
rm output
rm -f unexpectedly_did_not_fail
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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