From 0487eb1ce77e8a025db7fb3c7feea4d72298b978 Mon Sep 17 00:00:00 2001 From: chad Date: Mon, 23 May 2022 17:43:38 -0500 Subject: [PATCH] .github/: Enforce semantic versioning using semverver (#2635) --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53613220bf4..62693644a68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -172,3 +172,34 @@ jobs: - name: Check formatting run: cargo fmt -- --check + + rustsemver: + runs-on: ubuntu-latest + steps: + + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@a40b8845c0683271d9f53dfcb887a7e181d3918b # 0.9.1 + with: + access_token: ${{ github.token }} + + - uses: actions/checkout@v3 + + - name: Install Rust nightly-2022-05-16 + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2022-05-16 + override: true + components: rustc-dev,llvm-tools-preview + + - name: Install CMake + run: sudo apt-get install -y cmake + + - name: Install Semverver + run: cargo +nightly-2022-05-16 install --git https://github.com/rust-lang/rust-semverver + + - name: Enforce semantic versioning + run: cargo semver | tee semver_out + + - name: Fetch the version in the manifest and Check for semantic versioning errors + 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)