Skip to content

Commit 8d7e7ce

Browse files
committed
Add semver check to CI
Add a CI job to check if we have correctly set the crate version based on Semantic Versioning rules. This job was copied from: libp2p/rust-libp2p#2647 And uses this tool: https://github.com/rust-lang/rust-semverver
1 parent 0011150 commit 8d7e7ce

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/rust.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,26 @@ jobs:
107107
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER: "qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"
108108
run: cd embedded && cargo run --target thumbv7m-none-eabi
109109

110+
Rust-Semverver:
111+
runs-on: ubuntu-latest
112+
steps:
113+
- name: Cancel Previous Runs
114+
uses: styfle/cancel-workflow-action@a40b8845c0683271d9f53dfcb887a7e181d3918b # 0.9.1
115+
with:
116+
access_token: ${{ github.token }}
117+
- uses: actions/checkout@v3
118+
- name: Install Rust nightly-2022-05-16
119+
uses: actions-rs/toolchain@v1
120+
with:
121+
profile: minimal
122+
toolchain: nightly-2022-05-16
123+
override: true
124+
components: rustc-dev,llvm-tools-preview
125+
- name: Install CMake
126+
run: sudo apt-get install -y cmake
127+
- name: Install Semverver
128+
run: cargo +nightly-2022-05-16 install --git https://github.com/rust-lang/rust-semverver
129+
- name: Enforce semantic versioning
130+
run: cargo semver | tee semver_out
131+
- name: Fetch the version in the manifest and check for semantic versioning errors
132+
run: eval "current_version=$(grep -e '^version = .*$' Cargo.toml | cut -d ' ' -f 3)" && (head -n 1 semver_out | grep "\-> $current_version") || (echo "versioning mismatch" && return 1)

0 commit comments

Comments
 (0)