From 86cedc55ed24f842b18a25f52a2ba29c1a94e053 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Mon, 21 Oct 2024 12:44:50 +0000 Subject: [PATCH] Add SemVer compatibility checks This integrates the cargo-semver-checks tool in the CI to check for SemVer compatibility as per the Cargo reference (https://doc.rust-lang.org/cargo/reference/semver.html). The cargo-public-api tool is a viable alternative to cargo-semver-checks, but I didn't choose it because its comparison baseline needs to be stored in the repository and manually updated on each change. For zenoh, the 1.0.0 revision will be the baseline for the forseeable future. This comes with a caveat though: cargo-semver-checks accepts a "release type" argument which would be either patch or minor in zenoh's case. I specified "patch" since I expect patch releases to be more common. If minor API compatibility (as defined by the Cargo reference) are expected, then the CI workflow would need to be manually adjusted at the start and the end of the release cycle. --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7f3f32150..081863da85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,9 @@ jobs: - name: Install latest cargo-machete uses: taiki-e/install-action@cargo-machete + - name: Install latest cargo-semver-checks + uses: taiki-e/install-action@cargo-semver-checks + - name: Code format check run: cargo fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate" @@ -100,6 +103,9 @@ jobs: - name: Check unused dependencies run: cargo machete + - name: Check SemVer Compatibility + run: cargo semver-checks --verbose --default-features --baseline-rev 1.0.0 --package zenoh --release-type patch + test: name: Unit tests on ${{ matrix.os }} runs-on: ${{ matrix.os }}