17
17
18
18
jobs :
19
19
test :
20
- name : Test ${{ matrix.crate }}
20
+ name : Test ${{ matrix.crate }}${{ matrix.variant && format(' - {0}', matrix.variant) || '' }}
21
21
runs-on : ${{ fromJSON(
22
22
github.repository == 'libp2p/rust-libp2p' && (
23
- (contains(fromJSON('["libp2p-webrtc", "libp2p"]'), matrix.crate) && '["self-hosted", "linux", "x64", "2xlarge"]') ||
24
- (contains(fromJSON('["libp2p-quic", "libp2p-perf"]'), matrix.crate) && '["self-hosted", "linux", "x64", "xlarge"]') ||
25
- ' ["self-hosted", "linux", "x64", "large"]'
23
+ (contains(fromJSON('["libp2p-webrtc", "libp2p"]'), matrix.crate) && '["self-hosted", "linux", "x64", "2xlarge"]') ||
24
+ (contains(fromJSON('["libp2p-quic", "libp2p-perf"]'), matrix.crate) && '["self-hosted", "linux", "x64", "xlarge"]') ||
25
+ ' ["self-hosted", "linux", "x64", "large"]'
26
26
) || '"ubuntu-latest"') }}
27
27
timeout-minutes : 10
28
28
needs : gather_published_crates
29
29
strategy :
30
30
fail-fast : false
31
31
matrix :
32
+ include :
33
+ - crate : libp2p-kad
34
+ variant : all
35
+ features : --all-features
36
+ - crate : libp2p-kad
37
+ variant : k-4
38
+ features : --features serde,k-4
39
+ - crate : libp2p-kad
40
+ variant : k-8
41
+ features : --features serde,k-8
42
+ - crate : libp2p-kad
43
+ variant : k-12
44
+ features : --features serde,k-12
45
+ - crate : libp2p-kad
46
+ variant : k-16
47
+ features : --features serde,k-16
32
48
crate : ${{ fromJSON(needs.gather_published_crates.outputs.members) }}
33
49
env :
34
50
CRATE : ${{ matrix.crate }}
@@ -37,17 +53,17 @@ jobs:
37
53
with :
38
54
fetch-depth : 0
39
55
40
- - uses : r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 # v1.5.0
56
+ - uses : r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98
41
57
42
58
- uses : dtolnay/rust-toolchain@stable
43
59
44
- - uses : Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
60
+ - uses : Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
45
61
with :
46
62
shared-key : stable-cache
47
63
save-if : false
48
64
49
- - name : Run all tests
50
- run : cargo test --package "$CRATE" --all- features
65
+ - name : Run tests
66
+ run : cargo test --package "$CRATE" ${{ matrix. features }}
51
67
52
68
- name : Check if we compile without any features activated
53
69
run : cargo build --package "$CRATE" --no-default-features
@@ -65,28 +81,23 @@ jobs:
65
81
- name : Extract version from manifest
66
82
run : |
67
83
CRATE_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -e -r '.packages[] | select(.name == "'"$CRATE"'") | .version')
68
-
69
84
echo "CRATE_VERSION=$CRATE_VERSION" >> $GITHUB_ENV
70
85
71
86
- name : Enforce version in `workspace.dependencies` matches the latest version
72
87
if : env.CRATE != 'libp2p'
73
88
run : |
74
89
SPECIFIED_VERSION=$(tq "workspace.dependencies.$CRATE.version" -r --file ./Cargo.toml)
75
-
76
90
echo "Package version: $CRATE_VERSION";
77
91
echo "Specified version: $SPECIFIED_VERSION";
78
-
79
92
test "$CRATE_VERSION" = "$SPECIFIED_VERSION" || test "=$CRATE_VERSION" = "$SPECIFIED_VERSION"
80
93
81
94
- name : Enforce version in CHANGELOG.md matches the version in manifest
82
95
run : |
83
96
MANIFEST_PATH=$(cargo metadata --format-version=1 --no-deps | jq -e -r '.packages[] | select(.name == "'"$CRATE"'") | .manifest_path')
84
97
DIR_TO_CRATE=$(dirname "$MANIFEST_PATH")
85
98
VERSION_IN_CHANGELOG=$(awk -F' ' '/^## [0-9]+\.[0-9]+\.[0-9]+/{print $2; exit}' "$DIR_TO_CRATE/CHANGELOG.md")
86
-
87
99
echo "Package version: $CRATE_VERSION";
88
100
echo "Changelog version: $VERSION_IN_CHANGELOG";
89
-
90
101
test "$CRATE_VERSION" = "$VERSION_IN_CHANGELOG"
91
102
92
103
- name : Ensure manifest and CHANGELOG are properly updated
@@ -105,6 +116,7 @@ jobs:
105
116
HEAD_SHA : ${{ github.event.pull_request.head.sha }}
106
117
PR_BASE : ${{ github.event.pull_request.base.ref }}
107
118
119
+
108
120
wasm_tests :
109
121
name : Run all WASM tests
110
122
runs-on : ubuntu-latest
0 commit comments