Debian Codegraph @

.github/workflows/main.yml

raw
1 name: Main CI
2 on: [push, pull_request]
3
4 jobs:
5 build:
6 runs-on: ${{ matrix.os }}
7 strategy:
8 fail-fast: false
9 matrix:
10 os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
11 defaults:
12 run:
13 shell: bash
14
15 steps:
16 - name: Checkout code
17 uses: actions/checkout@v4
18 with:
19 ref: ${{ github.event.sha }}
20 fetch-depth: 0
21 fetch-tags: true
22 - name: Get tags from upstream, if needed
23 if: github.repository != 'Azure/azure-vm-utils'
24 run: |
25 git remote add upstream https://github.com/Azure/azure-vm-utils.git
26 git fetch upstream --tags
27 - name: Setup
28 run: |
29 sudo apt update
30 sudo apt install gcc pandoc cmake libjson-c-dev -y
31 - name: Build & install project with cmake with tests disabled
32 run: |
33 cmake -B build -S . -DENABLE_TESTS=0
34 make -C build
35 sudo make -C build install
36 - name: Verify installation
37 run: |
38 set -x
39 test -f /usr/local/lib/systemd/network/01-azure-unmanaged-sriov.network
40 test -f /usr/local/lib/udev/rules.d/10-azure-unmanaged-sriov.rules
41 test -f /usr/local/lib/udev/rules.d/80-azure-disk.rules
42 test -x /usr/local/sbin/azure-nvme-id
43 test -x /usr/local/sbin/azure-vm-utils-selftest
44 test -f /usr/local/share/initramfs-tools/hooks/azure-disk
45 test -f /usr/local/share/initramfs-tools/hooks/azure-unmanaged-sriov
46 test -f /usr/local/share/man/man8/azure-nvme-id.8
47 test -f /usr/local/share/man/man8/azure-vm-utils-selftest.8
48 azure-nvme-id --version
49 azure-vm-utils-selftest --skip-imds-validation --skip-symlink-validation
50 - name: Verify manpages can be generated
51 if: matrix.os != 'ubuntu-20.04'
52 run: |
53 make -C build generate-manpages
54 - name: Rebuild with tests enabled and run tests
55 run: |
56 set -x
57 sudo apt install -y libcmocka-dev cppcheck clang-format
58 rm -rf build
59 cmake -B build -S .
60 cd build
61 make
62
63 # ctest should invoke all tests, but to be sure let's run them individually
64 test -x ./debug_tests
65 ./debug_tests
66 test -x ./identify_disks_tests
67 ./identify_disks_tests
68 test -x ./identify_udev_tests
69 ./identify_udev_tests
70 test -x ./nvme_tests
71 ./nvme_tests
72
73 ctest --verbose -j
74 - name: Check source formatting with clang-format
75 run: |
76 make -C build check-clang-format || (echo "Run 'make clang-format' to fix formatting issues" && exit 1)
77 - name: Check cppcheck
78 run: |
79 make -C build cppcheck
80 - name: Check python scripts
81 run: |
82 python -m venv venv
83 source venv/bin/activate
84 if [ ${{ matrix.os }} == "ubuntu-20.04" ]; then
85 pip install -r selftest/test-requirements-frozen-py38.txt
86 else
87 pip install -r selftest/test-requirements-frozen.txt
88 fi
89 make -C build python-lint