11# Builds project on qemu with custom hmat settings
22name : Qemu
33
4- on : workflow_call
4+ on :
5+ workflow_call :
6+ inputs :
7+ short_run :
8+ description : Should the workflow run only basic tests?
9+ type : boolean
10+ default : false
11+ os :
12+ description : List of OSes
13+ type : string
14+ default : ' ["ubuntu-23.04"]'
515
616permissions :
717 contents : read
818
919jobs :
1020 qemu-build :
11- name : Qemu
21+ name : QEMU
22+ strategy :
23+ matrix :
24+ os : ${{ fromJson(inputs.os) }}
25+
26+ # Host QEMU on any Linux platform
1227 runs-on : ubuntu-22.04
1328
1429 steps :
@@ -79,11 +94,26 @@ jobs:
7994
8095 sudo -Sk genisoimage -output ubuntu-cloud-init.iso -volid cidata -joliet -rock ./user-data ./meta-data
8196
82- - name : Download ubuntu image
83- run : wget https://cloud-images.ubuntu.com/releases/lunar/release/ubuntu-23.04-server-cloudimg-amd64.img
97+ - name : Set vars if short run
98+ if : ${{ inputs.short_run == true }}
99+ run : |
100+ echo "SHORT_RUN=true" >> $GITHUB_ENV
101+ declare -a short_configs=("default.xml" "sock_2_var3.xml" "sock_4_var1_hmat.xml")
102+ echo "CONFIG_OPTIONS=${short_configs[@]}" >> $GITHUB_ENV
103+
104+ - name : Set vars if long run
105+ if : ${{ inputs.short_run == false }}
106+ run : |
107+ echo "SHORT_RUN=false" >> $GITHUB_ENV
108+ echo "CONFIG_OPTIONS=umf/scripts/qemu/configs/*.xml" >> $GITHUB_ENV
109+
110+ - name : Download Ubuntu image
111+ run : |
112+ OS_VER=$(echo ${{matrix.os}} | cut -d'-' -f2)
113+ wget https://cloud-images.ubuntu.com/releases/${OS_VER}/release/${{matrix.os}}-server-cloudimg-amd64.img -O qemu_image.img
84114
85115 - name : Resize image
86- run : qemu-img resize ./ubuntu-23.04-server-cloudimg-amd64 .img +4G
116+ run : qemu-img resize ./qemu_image .img +4G
87117
88118 - name : Build UMF in QEMU
89119 run : |
@@ -98,24 +128,26 @@ jobs:
98128
99129 - name : Run tests in QEMU
100130 run : |
101- for config_file in umf/scripts/qemu/configs/*.xml; do
131+ echo "Running tests for: ${CONFIG_OPTIONS}"
132+
133+ for config_file in ${CONFIG_OPTIONS}; do
102134 config_name=$(basename $config_file)
103135
104136 while ps -aux | grep qemu-system-x86_64 | grep -q -v grep; do
105137 echo "Waiting for QEMU to shut down..."
106138 sleep 5
107139 done
108140
109- echo "\n ### Testing ${config_name} ###"
141+ echo "### Testing ${config_name} ###"
110142 umf/scripts/qemu/start_qemu.sh ${config_name}
111143
112- ssh testuser@127.0.0.1 -p 2222 -t "bash /home/testuser/scripts/qemu/run-tests.sh COVERAGE ${config_name}"
144+ ssh testuser@127.0.0.1 -p 2222 -t "export SHORT_RUN=${SHORT_RUN} OS_FULL_NAME=${{matrix.os}} && /home/testuser/scripts/qemu/run-tests.sh COVERAGE ${config_name}"
113145 scp -r -P 2222 testuser@127.0.0.1:/home/testuser/coverage ./
114146 ssh testuser@127.0.0.1 -p 2222 -t "sudo shutdown -h now"
115147 done
116148 ls -al ./coverage
117149
118150 - uses : actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
119151 with :
120- name : exports-coverage-qemu-all
152+ name : exports-coverage-qemu-${{matrix.os}}
121153 path : coverage
0 commit comments