@@ -4,7 +4,7 @@ name: Qemu
4
4
on : workflow_call
5
5
6
6
env :
7
- CI_BRANCH : " ${{ github.head_ref || github.ref_name }}"
7
+ CI_BRANCH : " ${{ github.head_ref || github.ref_name }}"
8
8
9
9
permissions :
10
10
contents : read
13
13
qemu-build :
14
14
name : Qemu
15
15
runs-on : ubuntu-22.04
16
- strategy :
17
- matrix :
18
- config : [{name: 'default', hmat: 'on'},
19
- { name: 'sock_2_var1', hmat: 'off'},
20
- { name: 'sock_2_var1_hmat', hmat: 'on'},
21
- { name: 'sock_2_var2', hmat: 'off'},
22
- { name: 'sock_2_var2_hmat', hmat: 'on'},
23
- { name: 'sock_2_var3', hmat: 'off'},
24
- { name: 'sock_2_var3_hmat', hmat: 'on'},
25
- { name: 'sock_4_var1', hmat: 'off'},
26
- { name: 'sock_4_var1_hmat', hmat: 'on'},
27
- { name: 'sock_4_var2', hmat: 'off'},
28
- { name: 'sock_4_var2_hmat', hmat: 'on'}]
29
16
30
17
steps :
31
18
- name : Checkout
@@ -83,38 +70,40 @@ jobs:
83
70
run : wget https://cloud-images.ubuntu.com/releases/lunar/release/ubuntu-23.04-server-cloudimg-amd64.img
84
71
- name : Resize image
85
72
run : qemu-img resize ./ubuntu-23.04-server-cloudimg-amd64.img +4G
86
- - name : Print qemu args
87
- run : |
88
- # notice: should be sedded, but it hides status
89
- python3 scripts/qemu/qemu_config.py scripts/qemu/configs/${{matrix.config.name}}.xml
90
- - name : Run qemu
91
- run : |
92
- sudo qemu-system-x86_64 \
93
- -drive file=./ubuntu-23.04-server-cloudimg-amd64.img,format=qcow2,index=0,media=disk,id=hd \
94
- -cdrom ./ubuntu-cloud-init.iso \
95
- -machine q35,usb=off,hmat=${{matrix.config.hmat}} \
96
- -enable-kvm \
97
- -net nic -net user,hostfwd=tcp::2222-:22 \
98
- $(echo `python3 scripts/qemu/qemu_config.py scripts/qemu/configs/${{matrix.config.name}}.xml | sed s/''\''/'/g`) \
99
- -daemonize -display none
100
- - name : Run ssh keyscan
101
- run : |
102
- set +e
103
- ssh-keyscan -p 2222 -H 127.0.0.1 >> ~/.ssh/known_hosts
104
- while [ $? -ne 0 ]
105
- do
106
- echo "Trying to connect..."
107
- ps -aux | grep qemu
108
- sleep 5
109
- ssh-keyscan -p 2222 -H 127.0.0.1 >> ~/.ssh/known_hosts
110
- done
111
- - name : Run build on qemu
73
+ - name : Build
112
74
run : |
75
+ scripts/qemu/start_qemu.sh scripts/qemu/configs/default.xml
76
+
113
77
if [ ${{ github.event_name }} = 'pull_request' ]; then
114
78
CI_REPO="${{ github.event.pull_request.head.repo.full_name }}"
115
79
else
116
80
CI_REPO="$GITHUB_REPOSITORY"
117
81
fi
118
82
119
83
scp -P 2222 ${{github.workspace}}/scripts/qemu/run-build.sh [email protected] :/home/cxltest
84
+ scp -P 2222 ${{github.workspace}}/scripts/qemu/run-tests.sh [email protected] :/home/cxltest
120
85
ssh [email protected] -p 2222 -t "bash /home/cxltest/run-build.sh https://github.com/$CI_REPO ${{env.CI_BRANCH}}"
86
+
87
+ ssh [email protected] -p 2222 -t "sudo shutdown -h now"
88
+
89
+ - name : Run tests
90
+ run : |
91
+ for config_file in scripts/qemu/configs/*.xml; do
92
+ config_name=$(basename $config_file .xml)
93
+
94
+ echo testing $config_name
95
+ while ps -aux | grep qemu-system-x86_64 | grep -q -v grep; do
96
+ echo "Waiting for QEMU to shut down..."
97
+ sleep 5
98
+ done
99
+ scripts/qemu/start_qemu.sh $config_file
100
+
101
+ if [ ${{ github.event_name }} = 'pull_request' ]; then
102
+ CI_REPO="${{ github.event.pull_request.head.repo.full_name }}"
103
+ else
104
+ CI_REPO="$GITHUB_REPOSITORY"
105
+ fi
106
+
107
+ ssh [email protected] -p 2222 -t "bash /home/cxltest/run-tests.sh"
108
+ ssh [email protected] -p 2222 -t "sudo shutdown -h now"
109
+ done
0 commit comments