Skip to content

ci(qemu): wait for dpkg lock before apt-get install #126

ci(qemu): wait for dpkg lock before apt-get install

ci(qemu): wait for dpkg lock before apt-get install #126

name: OS Distro QEMU Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# start VMs and test in them
qemu-vm:
name: Test in VM (${{ matrix.arch }} ${{ matrix.os }})
runs-on: ${{ matrix.runner }}
env:
ACT_RUN: false
strategy:
fail-fast: false
matrix:
include:
# amd64
- arch: amd64
os: ubuntu24.04
runner: ubuntu-24.04
vm_name: "huatuo-os-distro-test-vm-ubuntu24.04"
vm_mac: "4A:6F:6C:69:6E:20"
vm_ip: "192.168.122.100"
- arch: amd64
os: ubuntu22.04
runner: ubuntu-24.04
vm_name: "huatuo-os-distro-test-vm-ubuntu22.04"
vm_mac: "4A:6F:6C:69:6E:20"
vm_ip: "192.168.122.100"
- arch: amd64
os: ubuntu20.04
runner: ubuntu-24.04
vm_name: "huatuo-os-distro-test-vm-ubuntu20.04"
vm_mac: "4A:6F:6C:69:6E:20"
vm_ip: "192.168.122.100"
# # arm64 (too slow)
# - arch: arm64
# os: ubuntu24.04
# runner: ubuntu-22.04-arm
# - arch: arm64
# os: ubuntu22.04
# runner: ubuntu-22.04-arm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
if: ${{ env.ACT_RUN != 'true' }}
uses: docker/setup-buildx-action@v3.3.0
- name: Host Init
run: |
.github/workflows/scripts/qemu-0-host-init.sh ${{ matrix.arch }} ${{ matrix.os }}
- name: Start VM
timeout-minutes: 30
run: |
.github/workflows/scripts/qemu-1-start-vm.sh ${{ matrix.arch }} ${{ matrix.os }} ${{ matrix.vm_name }} ${{ matrix.vm_mac }} ${{ matrix.vm_ip }}
- name: Run in VM
timeout-minutes: 120
run: |
ssh \
-i ${HOME}/.ssh/id_ed25519_vm \
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
root@${{ matrix.vm_ip }} "bash -s -- ${{ matrix.arch }} ${{ matrix.os }}" \
< .github/workflows/scripts/qemu-2-run-in-vm.sh
- name: Cleanup VM
if: success()
run: |
.github/workflows/scripts/qemu-3-cleanup.sh ${{ matrix.vm_name }} ${{ matrix.vm_mac }} ${{ matrix.vm_ip }}