|
| 1 | +--- |
| 2 | +name: QEMU/KVM Integration tests |
| 3 | +on: # yamllint disable-line rule:truthy |
| 4 | + pull_request: |
| 5 | + merge_group: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + types: |
| 9 | + - checks_requested |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | +jobs: |
| 18 | + qemu_kvm: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + scenario: |
| 25 | + - { image: "centos-9", env: "qemu-ansible-core-2.16" } |
| 26 | + - { image: "centos-10", env: "qemu-ansible-core-2.17" } |
| 27 | + # ansible/libdnf5 bug: https://issues.redhat.com/browse/RHELMISC-10110 |
| 28 | + # - { image: "fedora-41", env: "qemu-ansible-core-2.17" } |
| 29 | + - { image: "fedora-42", env: "qemu-ansible-core-2.17" } |
| 30 | + steps: |
| 31 | + - name: Set up /dev/kvm |
| 32 | + run: | |
| 33 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm.rules |
| 34 | + sudo udevadm control --reload-rules |
| 35 | + sudo udevadm trigger --name-match=kvm --settle |
| 36 | + ls -l /dev/kvm |
| 37 | +
|
| 38 | + - name: Disable man-db to speed up package install |
| 39 | + run: | |
| 40 | + echo "set man-db/auto-update false" | sudo debconf-communicate |
| 41 | + sudo dpkg-reconfigure man-db |
| 42 | +
|
| 43 | + - name: Install test dependencies |
| 44 | + run: | |
| 45 | + set -euxo pipefail |
| 46 | + python3 -m pip install --upgrade pip |
| 47 | + sudo apt update |
| 48 | + sudo apt install -y --no-install-recommends git ansible-core genisoimage qemu-system-x86 |
| 49 | + pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.5.1" |
| 50 | +
|
| 51 | + - name: Checkout repo |
| 52 | + uses: actions/checkout@v4 |
| 53 | + |
| 54 | + - name: Configure tox-lsr |
| 55 | + run: | |
| 56 | + curl -o ~/.config/linux-system-roles.json https://raw.githubusercontent.com/linux-system-roles/linux-system-roles.github.io/master/download/linux-system-roles.json |
| 57 | +
|
| 58 | + - name: Run qemu/kvm tox integration tests |
| 59 | + run: tox -e ${{ matrix.scenario.env }} -- --image-name ${{ matrix.scenario.image }} --make-batch --log-level=debug -- |
| 60 | + |
| 61 | + - name: Test result summary |
| 62 | + if: always() |
| 63 | + run: | |
| 64 | + set -euo pipefail |
| 65 | + while read code start end f; do |
| 66 | + if [ "$code" = "0" ]; then |
| 67 | + echo -n "PASS: " |
| 68 | + else |
| 69 | + echo -n "FAIL: " |
| 70 | + fi |
| 71 | + echo "$(basename $f)" |
| 72 | + done < batch.report |
| 73 | +
|
| 74 | + - name: Show test logs on failure |
| 75 | + if: failure() |
| 76 | + run: | |
| 77 | + set -euo pipefail |
| 78 | + for f in tests/*.log; do |
| 79 | + echo "::group::$(basename $f)" |
| 80 | + cat "$f" |
| 81 | + echo "::endgroup::" |
| 82 | + done |
0 commit comments