1
1
# Builds project on qemu with custom hmat settings
2
2
name : Qemu
3
3
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"]'
5
15
6
16
permissions :
7
17
contents : read
8
18
9
19
jobs :
10
20
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
12
27
runs-on : ubuntu-22.04
13
28
14
29
steps :
@@ -79,11 +94,26 @@ jobs:
79
94
80
95
sudo -Sk genisoimage -output ubuntu-cloud-init.iso -volid cidata -joliet -rock ./user-data ./meta-data
81
96
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
84
114
85
115
- 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
87
117
88
118
- name : Build UMF in QEMU
89
119
run : |
@@ -98,24 +128,26 @@ jobs:
98
128
99
129
- name : Run tests in QEMU
100
130
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
102
134
config_name=$(basename $config_file)
103
135
104
136
while ps -aux | grep qemu-system-x86_64 | grep -q -v grep; do
105
137
echo "Waiting for QEMU to shut down..."
106
138
sleep 5
107
139
done
108
140
109
- echo "\n ### Testing ${config_name} ###"
141
+ echo "### Testing ${config_name} ###"
110
142
umf/scripts/qemu/start_qemu.sh ${config_name}
111
143
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}"
113
145
scp -r -P 2222 testuser@127.0.0.1:/home/testuser/coverage ./
114
146
ssh testuser@127.0.0.1 -p 2222 -t "sudo shutdown -h now"
115
147
done
116
148
ls -al ./coverage
117
149
118
150
- uses : actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
119
151
with :
120
- name : exports-coverage-qemu-all
152
+ name : exports-coverage-qemu-${{matrix.os}}
121
153
path : coverage
0 commit comments