Skip to content

Run UEFI images in qemu #4

Run UEFI images in qemu

Run UEFI images in qemu #4

name: Run UEFI images in qemu
on:
workflow_dispatch:
workflow_call:
jobs:
Distro:
runs-on: [qemu,ARM64]
timeout-minutes: 480
strategy:
fail-fast: false
matrix:
board: ["uefi-arm64"]
target: ["Bookworm_current","Jammy_current"]
steps:
- name: Prepare
run: |
echo ${{ matrix.board }}
echo ${{ matrix.target }}
- name: Prepare
run: |
sudo apt-get -y install qemu-kvm libvirt-daemon-system libvirt-clients virtinst cpu-checker libguestfs-tools libosinfo-bin gir1.2-spiceclientgtk-3.0 virt-viewer sshpass nmap
- name: Remove previous if any
run: |
sudo virsh destroy Armbian-${{ matrix.board }}-${{ matrix.target }} || true
sudo virsh undefine Armbian-${{ matrix.board }}-${{ matrix.target }} || true
- name: Download and prepare
run: |
rm -f temp.img
wget https://redirect.armbian.com/${{ matrix.board }}/${{ matrix.target }} -O - | xz | xz -d > temp.img
sudo qemu-img convert -f raw -O qcow2 temp.img /var/lib/libvirt/images/Armbian-${{ matrix.board }}-${{ matrix.target }}.qcow2
sudo qemu-img resize /var/lib/libvirt/images/Armbian-${{ matrix.board }}-${{ matrix.target }}.qcow2 +10G
- name: Boot it up and wait 1 minute
run: |
sudo virt-install --name Armbian --memory 2048 --vcpus 4 --disk \
/var/lib/libvirt/images/Armbian-${{ matrix.board }}-${{ matrix.target }}.qcow2,bus=sata --import --os-variant ubuntu22.04 --noautoconsole
sleep 1m
- name: Find and login
run: |
export TERM=vt100
# get ip
MAC=$(sudo virsh domiflist Armbian | tail -2 | head -1 | awk '{print $NF}')
USER_HOST=$(sudo nmap -sP 10.0.40.0/24 | grep -i "$MAC" -B 2 | head -1 | awk '{print $NF}')
# login credentials
USER_ROOT=root
PASS_ROOT=testpassword
USER_NORMAL=guest
PASS_NORMAL=testpassword
expect -c "
spawn sshpass -p 1234 ssh -o "StrictHostKeyChecking=accept-new" ${USER_ROOT}@${USER_HOST}
set timeout 120
expect \"Create root password: \"
send \"${PASS_ROOT}\r\"
expect \"Repeat root password: \"
send \"${PASS_ROOT}\r\"
expect \"zsh\"
send \"2\r\"
expect \"*to abort\"
send \"${USER_NORMAL}\r\"
expect \"Create*password:\"
send \"${PASS_NORMAL}\r\"
expect \"Repeat*password:\"
send \"${PASS_NORMAL}\r\"
expect \"Please provide your real name: \"
send \"${NAME_NORMAL}\r\"
expect \"*language based on your location*\"
send \"y\r\"
expect \"*#\"
send \"exit\r\"
"
sshpass -p ${PASS_ROOT} ssh -o "StrictHostKeyChecking=accept-new" ${USER_ROOT}@${USER_HOST} "apt-get -y update"
sshpass -p ${PASS_ROOT} ssh -o "StrictHostKeyChecking=accept-new" ${USER_ROOT}@${USER_HOST} "apt-get -y install maim"
sshpass -p ${PASS_ROOT} ssh -o "StrictHostKeyChecking=accept-new" ${USER_ROOT}@${USER_HOST} "apt-get -y upgrade"
sshpass -p ${PASS_ROOT} ssh -o "StrictHostKeyChecking=accept-new" ${USER_ROOT}@${USER_HOST} "git clone https://github.com/armbian/configng -b desktop"
sshpass -p ${PASS_ROOT} ssh -o "StrictHostKeyChecking=accept-new" ${USER_ROOT}@${USER_HOST} "cd configng/test; ./desktop_test.sh"
sleep 10
sshpass -p ${PASS_NORMAL} ssh -o "StrictHostKeyChecking=accept-new" ${USER_NORMAL}@${USER_HOST} "export DISPLAY=:0;maim" > "${{ env.RELEASE }}-${{ env.DESKTOP }}.png"
- name: Upload artefacts
uses: actions/upload-artifact@v3
with:
name: "${{ env.RELEASE }}-${{ env.DESKTOP }}.png"
path: ${{ env.RELEASE }}-${{ env.DESKTOP }}.png
if-no-files-found: error
retention-days: 7