@@ -11,75 +11,118 @@ on: # yamllint disable-line rule:truthy
1111 branches :
1212 - main
1313 workflow_dispatch :
14- env :
15- TOX_ENV : qemu-ansible-core-2.16
1614
1715permissions :
1816 contents : read
1917jobs :
20- tox :
18+ qemu_kvm :
2119 runs-on : ubuntu-latest
2220
2321 strategy :
2422 fail-fast : false
2523 matrix :
26- image :
27- - centos-9
28- - centos-10
24+ scenario :
25+ - { image: " centos-9", env: "qemu-ansible-core-2.16" }
26+ - { image: " centos-10", env: "qemu-ansible-core-2.17" }
2927 # ansible/libdnf5 bug: https://issues.redhat.com/browse/RHELMISC-10110
30- # - fedora-41
31- - fedora-42
32-
28+ # - { image: "fedora-41", env: "qemu-ansible-core-2.17" }
29+ - { image: "fedora-42", env: "qemu-ansible-core-2.17" }
3330 steps :
31+ - name : Checkout repo
32+ uses : actions/checkout@v4
33+
34+ - name : Check if platform is supported
35+ id : check_platform
36+ run : |
37+ set -euxo pipefail
38+ image="${{ matrix.scenario.image }}"
39+
40+ # convert image to tag formats
41+ platform=
42+ platform_version=
43+ case "$image" in
44+ centos-*) platform=el; platform_version=el"${image#centos-}" ;;
45+ fedora-*) platform=fedora; platform_version="${image/-/}" ;;
46+ esac
47+ supported=
48+ if yq -e '.galaxy_info.galaxy_tags[] | select(. == "'${platform_version}'" or . == "'${platform}'")' meta/main.yml; then
49+ supported=true
50+ fi
51+
52+ echo "supported=$supported" >> "$GITHUB_OUTPUT"
53+
3454 - name : Set up /dev/kvm
55+ if : steps.check_platform.outputs.supported
3556 run : |
3657 echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm.rules
3758 sudo udevadm control --reload-rules
3859 sudo udevadm trigger --name-match=kvm --settle
3960 ls -l /dev/kvm
4061
4162 - name : Disable man-db to speed up package install
63+ if : steps.check_platform.outputs.supported
4264 run : |
4365 echo "set man-db/auto-update false" | sudo debconf-communicate
4466 sudo dpkg-reconfigure man-db
4567
4668 - name : Install test dependencies
69+ if : steps.check_platform.outputs.supported
4770 run : |
4871 set -euxo pipefail
4972 python3 -m pip install --upgrade pip
5073 sudo apt update
5174 sudo apt install -y --no-install-recommends git ansible-core genisoimage qemu-system-x86
5275 pip3 install "git+https://github.com/linux-system-roles/[email protected] " 5376
54- - name : Checkout repo
55- uses : actions/checkout@v4
56-
5777 - name : Configure tox-lsr
58- run : |
59- 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
78+ if : steps.check_platform.outputs.supported
79+ run : >-
80+ curl -o ~/.config/linux-system-roles.json
81+ https://raw.githubusercontent.com/linux-system-roles/linux-system-roles.github.io/master/download/linux-system-roles.json
6082
61- - name : Run tox integration tests
62- run : tox -e ${{ env.TOX_ENV }} -- --image-name ${{ matrix.image }} --make-batch --log-level=debug --
83+ - name : Run qemu/kvm tox integration tests
84+ if : steps.check_platform.outputs.supported
85+ run : >-
86+ tox -e ${{ matrix.scenario.env }} -- --image-name ${{ matrix.scenario.image }} --make-batch
87+ --log-level=debug --skip-tags tests::infiniband --
6388
6489 - name : Test result summary
65- if : always()
90+ if : steps.check_platform.outputs.supported && always()
6691 run : |
6792 set -euo pipefail
68- while read code start end f; do
93+ # some platforms may have setup/cleanup playbooks - need to find the
94+ # actual test playbook that starts with tests_
95+ while read code start end test_files; do
96+ for f in $test_files; do
97+ f="$(basename $f)"
98+ if [[ "$f" =~ ^tests_ ]]; then
99+ break
100+ fi
101+ done
69102 if [ "$code" = "0" ]; then
70103 echo -n "PASS: "
71104 else
72105 echo -n "FAIL: "
73106 fi
74- echo "$(basename $f) "
107+ echo "$f "
75108 done < batch.report
76109
77110 - name : Show test logs on failure
78- if : failure()
111+ if : steps.check_platform.outputs.supported && failure()
79112 run : |
80113 set -euo pipefail
81114 for f in tests/*.log; do
82115 echo "::group::$(basename $f)"
83116 cat "$f"
84117 echo "::endgroup::"
85118 done
119+
120+ - name : Set commit status as success with a description that platform is skipped
121+ if : ${{ steps.check_platform.outputs.supported == '' }}
122+ uses : myrotvorets/set-commit-status-action@master
123+ with :
124+ sha : ${{ needs.prepare_vars.outputs.head_sha }}
125+ status : success
126+ context : " ${{ github.workflow }} / qemu_kvm (${{ matrix.scenario.image }}, ${{ matrix.scenario.env }}) (pull_request)"
127+ description : The role does not support this platform. Skipping.
128+ targetUrl : " "
0 commit comments