Skip to content

Commit 3371d7c

Browse files
authored
.github/workflows: Enforce semver compliance with cargo semver-checks (libp2p#2647)
1 parent eb10af7 commit 3371d7c

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,52 @@ jobs:
210210
ALL_FEATURES=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "libp2p") | .features | keys | map(select(. != "full")) | sort | join(" ")')
211211
FULL_FEATURE=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "libp2p") | .features["full"] | sort | join(" ")')
212212
213+
test "$ALL_FEATURES = $FULL_FEATURE"
214+
213215
echo "$ALL_FEATURES";
214216
echo "$FULL_FEATURE";
215217
216218
test "$ALL_FEATURES" = "$FULL_FEATURE"
219+
220+
gather_crates_for_semver_checks:
221+
runs-on: ubuntu-latest
222+
outputs:
223+
members: ${{ steps.cargo-metadata.outputs.members }}
224+
steps:
225+
- uses: actions/checkout@v3
226+
227+
- id: cargo-metadata
228+
run: |
229+
WORKSPACE_MEMBERS=$(cargo metadata --format-version=1 --no-deps | jq -c '.packages | .[] | select(.publish == null) | .name' | jq -s '.' | jq -c '.')
230+
echo "::set-output name=members::${WORKSPACE_MEMBERS}"
231+
232+
semver-check:
233+
runs-on: ubuntu-latest
234+
needs: gather_crates_for_semver_checks
235+
strategy:
236+
fail-fast: false
237+
matrix:
238+
crate: ${{ fromJSON(needs.gather_crates_for_semver_checks.outputs.members) }}
239+
steps:
240+
- name: Cancel Previous Runs
241+
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
242+
with:
243+
access_token: ${{ github.token }}
244+
245+
- uses: actions/checkout@v3
246+
247+
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
248+
with:
249+
profile: minimal
250+
toolchain: stable
251+
override: true
252+
253+
- name: Install Protoc
254+
uses: arduino/setup-protoc@v1
255+
256+
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0
257+
258+
- run: cargo install cargo-semver-checks
259+
260+
- name: Semver Check
261+
run: cargo semver-checks check-release -p ${{ matrix.crate }}

misc/keygen/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ license = "MIT"
77
repository = "https://github.com/libp2p/rust-libp2p"
88
keywords = ["peer-to-peer", "libp2p", "networking"]
99
categories = ["network-programming", "asynchronous"]
10+
publish = false
1011

1112
[dependencies]
1213
clap = {version = "3.1.6", features = ["derive"]}

0 commit comments

Comments
 (0)