Skip to content

Update Rust crate itertools to 0.14.0 #310

Update Rust crate itertools to 0.14.0

Update Rust crate itertools to 0.14.0 #310

name: Test build hwlib Rust package with sbuild
on:
push:
branches: [ main ]
paths:
- client/**
- Cargo.*
- ".github/workflows/test_hwlib_debian_build.yaml"
pull_request:
branches: [ main ]
paths:
- client/**
- Cargo.*
- ".github/workflows/test_hwlib_debian_build.yaml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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
id: get-version
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 "version=$BASE_VERSION" >> $GITHUB_OUTPUT
echo "Git tag base version: $BASE_VERSION"
- name: Check hwlib and hwctl Cargo versions
run: |
echo "Using Git tag version: ${{ steps.get-version.outputs.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 != ${{ steps.get-version.outputs.version }} ]]; then
echo "Version mismatch in $manifest: $CARGO_VERSION (expected ${{ steps.get-version.outputs.version }})"
exit 1
fi
done
- name: Check Debian changelog version
run: |
echo "Using Git tag version: ${{ steps.get-version.outputs.version }}"
DEBIAN_VERSION=$(dpkg-parsechangelog --show-field Version | cut -d'~' -f1)
if [[ $DEBIAN_VERSION != ${{ steps.get-version.outputs.version }} ]]; then
echo "Debian changelog version mismatch: $DEBIAN_VERSION (expected ${{ steps.get-version.outputs.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
# Prevent lxd-agent from getting restarted on apt upgrades.
# https://warthogs.atlassian.net/browse/ISD-2139
- name: Disable lxd-agent restart
run: |
mkdir -p /etc/needrestart/conf.d
echo '$nrconf{override_rc}{qr(^lxd-agent.service$)} = 0;' | sudo tee /etc/needrestart/conf.d/lxdagent.conf
- name: Download dependencies
run: |
set -xeu
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt install -y \
debhelper \
devscripts \
sbuild \
schroot \
debootstrap \
jq \
mmdebstrap \
uidmap \
sbuild-debian-developer-setup \
dh-cargo \
pkg-config \
libssl-dev
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Vendor the dependencies
run: |
cargo install cargo-vendor-filterer
./debian/vendor-rust.sh
- name: Generate checksums
run: ./debian/generate_checksums.py
- run: dpkg-buildpackage -us -uc -S
- name: Setup sbuild and build the package
run: |
set -xeu
mkdir -p ~/.cache/sbuild
echo
mmdebstrap --variant=buildd --components=main,restricted,universe oracular ~/.cache/sbuild/oracular-amd64.tar.zst
echo "Running sbuild-debian-developer-setup"
sudo sbuild-debian-developer-setup
sudo sbuild-adduser $USER
newgrp sbuild
echo "Creating ~/.sbuildrc"
cat <<'EOF' >> ~/.sbuildrc
$chroot_mode = 'unshare';
$run_autopkgtest = 0;
$autopkgtest_root_args = '';
$autopkgtest_opts = [ '--apt-upgrade', '--', 'unshare', '--release', '%r', '--arch', '%a' ];
EOF
sudo sbuild-update -udcar u
schroot -l | grep sbuild
PACKAGE_DSC=$(find ../ -name "*.dsc" | head -n 1)
if [ -z "$PACKAGE_DSC" ]; then
echo "No .dsc file found"
exit 1
fi
echo "Running sbuild for $PACKAGE_DSC"
sbuild $PACKAGE_DSC -d oracular -v
- run: lintian --pedantic --verbose