Skip to content

Commit 0a39dec

Browse files
committed
chore(ci): test libp2p-kad with all k-n features
1 parent 6803d79 commit 0a39dec

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,34 @@ env:
1717

1818
jobs:
1919
test:
20-
name: Test ${{ matrix.crate }}
20+
name: Test ${{ matrix.crate }}${{ matrix.variant && format(' - {0}', matrix.variant) || '' }}
2121
runs-on: ${{ fromJSON(
2222
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"]'
2626
) || '"ubuntu-latest"') }}
2727
timeout-minutes: 10
2828
needs: gather_published_crates
2929
strategy:
3030
fail-fast: false
3131
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
3248
crate: ${{ fromJSON(needs.gather_published_crates.outputs.members) }}
3349
env:
3450
CRATE: ${{ matrix.crate }}
@@ -37,17 +53,17 @@ jobs:
3753
with:
3854
fetch-depth: 0
3955

40-
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0
56+
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98
4157

4258
- uses: dtolnay/rust-toolchain@stable
4359

44-
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
60+
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
4561
with:
4662
shared-key: stable-cache
4763
save-if: false
4864

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 }}
5167

5268
- name: Check if we compile without any features activated
5369
run: cargo build --package "$CRATE" --no-default-features
@@ -65,28 +81,23 @@ jobs:
6581
- name: Extract version from manifest
6682
run: |
6783
CRATE_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -e -r '.packages[] | select(.name == "'"$CRATE"'") | .version')
68-
6984
echo "CRATE_VERSION=$CRATE_VERSION" >> $GITHUB_ENV
7085
7186
- name: Enforce version in `workspace.dependencies` matches the latest version
7287
if: env.CRATE != 'libp2p'
7388
run: |
7489
SPECIFIED_VERSION=$(tq "workspace.dependencies.$CRATE.version" -r --file ./Cargo.toml)
75-
7690
echo "Package version: $CRATE_VERSION";
7791
echo "Specified version: $SPECIFIED_VERSION";
78-
7992
test "$CRATE_VERSION" = "$SPECIFIED_VERSION" || test "=$CRATE_VERSION" = "$SPECIFIED_VERSION"
8093
8194
- name: Enforce version in CHANGELOG.md matches the version in manifest
8295
run: |
8396
MANIFEST_PATH=$(cargo metadata --format-version=1 --no-deps | jq -e -r '.packages[] | select(.name == "'"$CRATE"'") | .manifest_path')
8497
DIR_TO_CRATE=$(dirname "$MANIFEST_PATH")
8598
VERSION_IN_CHANGELOG=$(awk -F' ' '/^## [0-9]+\.[0-9]+\.[0-9]+/{print $2; exit}' "$DIR_TO_CRATE/CHANGELOG.md")
86-
8799
echo "Package version: $CRATE_VERSION";
88100
echo "Changelog version: $VERSION_IN_CHANGELOG";
89-
90101
test "$CRATE_VERSION" = "$VERSION_IN_CHANGELOG"
91102
92103
- name: Ensure manifest and CHANGELOG are properly updated
@@ -105,6 +116,7 @@ jobs:
105116
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
106117
PR_BASE: ${{ github.event.pull_request.base.ref }}
107118

119+
108120
wasm_tests:
109121
name: Run all WASM tests
110122
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)