Skip to content

Commit

Permalink
fix(specs): add libcmocka-devel to BuildRequires
Browse files Browse the repository at this point in the history
With tests enabled it's a requirement to build.

Add RPM tests to CI to keep regular coverage using containers.

Signed-off-by: Chris Patterson <[email protected]>
  • Loading branch information
cjp256 committed Feb 6, 2025
1 parent dbd68a1 commit 0ea7c1e
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 2 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/rpms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: RPM Packaging CI
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
container:
- fedora:41
- ghcr.io/almalinux/9-base:latest
- ghcr.io/almalinux/8-base:latest
- mcr.microsoft.com/cbl-mariner/base/core:2.0
- mcr.microsoft.com/azurelinux/base/core:3.0

container:
image: ${{ matrix.container }}
options: --user root

defaults:
run:
shell: bash

steps:
- name: Identify OS
run: cat /etc/os-release
- name: Instll dependencies
run: |
set -x
id
case "${{ matrix.container }}" in
*almalinux/8*)
dnf install -y 'dnf-command(config-manager)'
dnf config-manager --set-enabled powertools
;;
*almalinux/9*)
dnf install -y 'dnf-command(config-manager)'
dnf config-manager --set-enabled crb
;;
*azurelinux*|*cbl-mariner*)
export HOME=/root # tdnf requires HOME to be set to /root
tdnf install -y awk ca-certificates dnf --verbose
;;
esac
dnf install -y git sudo
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
fetch-depth: 0
fetch-tags: true
- name: Get tags from upstream, if needed
if: github.repository != 'Azure/azure-vm-utils'
run: |
git remote add upstream https://github.com/Azure/azure-vm-utils.git
git fetch upstream --tags
- name: Build RPMs
run: |
set -x
git config --global --add safe.directory "$(pwd)"
./scripts/build-rpm.sh
- name: Install rpms
run: |
rpm -Uvh -i out/*.rpm
- name: Verify installation
run: |
set -x
rpm -qa azure-vm-utils
test -f /usr/share/man/man8/azure-nvme-id.8.gz
test -f /usr/sbin/azure-nvme-id || test -f /usr/bin/azure-nvme-id
test -f /usr/lib/dracut/modules.d/97azure-disk/module-setup.sh
test -f /usr/lib/udev/rules.d/80-azure-disk.rules
azure-nvme-id --version
1 change: 1 addition & 0 deletions packaging/almalinux
4 changes: 3 additions & 1 deletion packaging/fedora/azure-vm-utils.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Source0: %{name}_dev.tgz

BuildRequires: cmake
BuildRequires: gcc
BuildRequires: libcmocka-devel

%description
A collection of utilities and udev rules to make the most of the Linux
Expand All @@ -34,4 +35,5 @@ experience on Azure.
%{_mandir}/man8/azure-nvme-id.8.gz

%changelog
%autochangelog
* Wed Feb 05 2025 Test <[email protected]> - %{__git_version}-%{__git_release}
- Test test test
1 change: 1 addition & 0 deletions packaging/mariner/azure-vm-utils.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ BuildRequires: cmake
BuildRequires: gcc
BuildRequires: glibc-devel
BuildRequires: kernel-headers
BuildRequires: libcmocka-devel

%description
A collection of utilities and udev rules to make the most of the Linux
Expand Down
7 changes: 6 additions & 1 deletion scripts/build-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ cd "${project_dir}/packaging/${distro}"

# Install dependencies.
build_requirements=$(grep ^BuildRequires azure-vm-utils.spec | awk '{{print $2}}' | tr '\n' ' ')
sudo dnf install -y ${build_requirements}
install_build_requirements_cmd="dnf install -y ${build_requirements} rpm-build dracut"
if [[ $UID -ne 0 ]]; then
sudo $install_build_requirements_cmd
else
$install_build_requirements_cmd
fi

# Build RPM.
rpmbuild -ba --define "__git_version ${version}" --define "__git_release ${release}" --define "_topdir ${build_dir}" azure-vm-utils.spec
Expand Down

0 comments on commit 0ea7c1e

Please sign in to comment.