name: Main CI on: [push, pull_request] jobs: build: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] defaults: run: shell: bash steps: - name: Checkout code uses: actions/checkout@v4 with: ref: ${{ github.event.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: Setup run: | sudo apt update sudo apt install gcc pandoc cmake libjson-c-dev -y - name: Build & install project with cmake with tests disabled run: | cmake -B build -S . -DENABLE_TESTS=0 make -C build sudo make -C build install - name: Verify installation run: | set -x test -f /usr/local/lib/systemd/network/01-azure-unmanaged-sriov.network test -f /usr/local/lib/udev/rules.d/10-azure-unmanaged-sriov.rules test -f /usr/local/lib/udev/rules.d/80-azure-disk.rules test -x /usr/local/sbin/azure-nvme-id test -x /usr/local/sbin/azure-vm-utils-selftest test -f /usr/local/share/initramfs-tools/hooks/azure-disk test -f /usr/local/share/initramfs-tools/hooks/azure-unmanaged-sriov test -f /usr/local/share/man/man8/azure-nvme-id.8 test -f /usr/local/share/man/man8/azure-vm-utils-selftest.8 azure-nvme-id --version azure-vm-utils-selftest --skip-imds-validation --skip-symlink-validation - name: Verify manpages can be generated if: matrix.os != 'ubuntu-20.04' run: | make -C build generate-manpages - name: Rebuild with tests enabled and run tests run: | set -x sudo apt install -y libcmocka-dev cppcheck clang-format rm -rf build cmake -B build -S . cd build make # ctest should invoke all tests, but to be sure let's run them individually test -x ./debug_tests ./debug_tests test -x ./identify_disks_tests ./identify_disks_tests test -x ./identify_udev_tests ./identify_udev_tests test -x ./nvme_tests ./nvme_tests ctest --verbose -j - name: Check source formatting with clang-format run: | make -C build check-clang-format || (echo "Run 'make clang-format' to fix formatting issues" && exit 1) - name: Check cppcheck run: | make -C build cppcheck - name: Check python scripts run: | python -m venv venv source venv/bin/activate if [ ${{ matrix.os }} == "ubuntu-20.04" ]; then pip install -r selftest/test-requirements-frozen-py38.txt else pip install -r selftest/test-requirements-frozen.txt fi make -C build python-lint