Skip to content

Commit

Permalink
Add job to sbuild CI to validate client version consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
nadzyah committed Dec 11, 2024
1 parent da2c7f0 commit 48801d3
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/test_hwlib_debian_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,56 @@ concurrency:


jobs:
validate-version:
runs-on: [self-hosted, linux, large, noble, x64]
defaults:
run:
working-directory: client
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Get version from git tag
run: |
VERSION=$(git describe --tags --match 'v*.*.*' --dirty)
if [[ $VERSION == *-dirty ]]; then
echo "Version includes -dirty. Ensure working tree is clean before building."
exit 1
fi
# Extract base version (strip 'v', commit count, and hash)
BASE_VERSION=$(echo "$VERSION" | sed -E 's/^v([0-9]+\.[0-9]+\.[0-9]+)(-.*)?$/\1/')
echo "GIT_VERSION=$BASE_VERSION" >> $GITHUB_ENV
echo "Git tag base version: $BASE_VERSION"
- name: Check hwlib and hwctl Cargo versions
run: |
echo "Using Git tag version: ${{ env.GIT_VERSION }}"
for manifest in hwlib/Cargo.toml hwctl/Cargo.toml; do
CARGO_VERSION=$(cargo metadata --manifest-path "$manifest" --no-deps --format-version 1 | jq -r '.packages[0].version')
if [[ $CARGO_VERSION != ${{ env.GIT_VERSION }} ]]; then
echo "Version mismatch in $manifest: $CARGO_VERSION (expected ${{ env.GIT_VERSION }})"
exit 1
fi
done
- name: Check Debian changelog version
run: |
echo "Using Git tag version: ${{ env.GIT_VERSION }}"
DEBIAN_VERSION=$(dpkg-parsechangelog --show-field Version | cut -d'~' -f1)
if [[ $DEBIAN_VERSION != ${{ env.GIT_VERSION }} ]]; then
echo "Debian changelog version mismatch: $DEBIAN_VERSION (expected ${{ env.GIT_VERSION }})"
exit 1
fi
build:
runs-on: [self-hosted, linux, large, noble, x64]
defaults:
run:
working-directory: client
needs: [validate-version]
steps:
- name: Checkout the repository
uses: actions/checkout@v4
Expand Down

0 comments on commit 48801d3

Please sign in to comment.