Skip to content

qemu-runtime

qemu-runtime #6

Workflow file for this run

name: qemu-runtime
# Builds a Weston desktop image with VSCode + the launcher pulled in,
# boots it under QEMU via Yocto's testimage class, and runs OEQA test
# cases (in lib/oeqa/runtime/cases/vscode_launcher.py) that verify:
# - the postinst added the launcher block to weston.ini
# - the VSCode binary is on the target and `--version` works
# - Weston actually started on boot
# - VSCode can connect to the live wayland-0 socket and stay alive
#
# This is heavy CI (full Yocto image build, ~1-3 hours from cold
# sstate) so it runs weekly + on manual dispatch rather than per-PR.
on:
schedule:
# 03:17 UTC Sunday. Off-peak; small offset so cdn.kernel.org +
# mirrors aren't slammed alongside everyone else's nightly.
- cron: '17 3 * * 0'
workflow_dispatch:
# Don't pile up qemu runs if one is already in progress.
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
testimage:
name: testimage (scarthgap / qemux86-64)
runs-on: ubuntu-22.04
timeout-minutes: 360
steps:
- uses: actions/checkout@v4
with:
path: meta-vscode
- name: Free disk space
# Yocto builds need ~25-30 GB; the default GHA runner has ~14
# GB free on /. Reclaim ~30 GB by purging things we don't use.
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \
/opt/hostedtoolcache/CodeQL /usr/local/share/boost \
"$AGENT_TOOLSDIRECTORY" \
/usr/local/.ghcup \
/opt/hostedtoolcache/*
sudo apt-get autoremove --purge -y \
azure-cli google-chrome-stable firefox powershell mongodb-* \
mysql-* postgresql-* snapd || true
# Drop docker images that ship preloaded on the runner; they
# eat ~10 GB on /var/lib/docker by default.
sudo docker image prune -af 2>/dev/null || true
df -h
- name: Install Yocto host + qemu deps
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
gawk wget git diffstat unzip texinfo gcc build-essential chrpath \
socat cpio python3 python3-pip python3-pexpect xz-utils debianutils \
iputils-ping python3-git python3-jinja2 python3-subunit zstd liblz4-tool \
file locales libacl1 \
qemu-system-x86 qemu-utils
sudo locale-gen en_US.UTF-8
# KVM is the difference between qemu booting in seconds vs
# minutes. GHA hosted runners ship /dev/kvm; just make the
# runner user a member of the kvm group.
sudo usermod -aG kvm "$USER"
ls -la /dev/kvm || true
# No restore-keys -- we don't want to fuzzy-match caches from
# other workflows in this repo. ci.yml's parse jobs also cache a
# poky checkout under poky-scarthgap-v1 with stamps + downloads
# baked into poky/build/{tmp,downloads}, which collides with this
# workflow's overrides and was the cause of an earlier
# "vscode do_fetch skipped, do_unpack can't find tarball" failure.
- name: Cache poky + bitbake build state
uses: actions/cache@v4
with:
path: |
poky
sstate-cache
key: qemu-runtime-poky-scarthgap-${{ hashFiles('meta-vscode/recipes-devtools/vscode/*.bb') }}
- name: Clone poky (scarthgap)
run: |
if [ ! -d poky/.git ]; then
git clone --depth 1 --branch scarthgap \
https://git.yoctoproject.org/poky poky
else
git -C poky fetch --depth 1 origin scarthgap:refs/remotes/origin/scarthgap
git -C poky checkout -B scarthgap refs/remotes/origin/scarthgap
fi
- name: Cache downloads
uses: actions/cache@v4
with:
path: poky/build/downloads
key: qemu-runtime-downloads-scarthgap-${{ hashFiles('meta-vscode/recipes-devtools/vscode/*.bb') }}
- name: Configure build
run: |
set -eo pipefail
cd poky
source oe-init-build-env build
cat > conf/local.conf <<'EOF'
MACHINE = "qemux86-64"
DISTRO = "poky"
BB_NUMBER_THREADS = "2"
PARALLEL_MAKE = "-j 2"
CONF_VERSION = "2"
PACKAGE_CLASSES ?= "package_rpm"
# Leave SSTATE_DIR + DL_DIR at their bitbake defaults
# (${TOPDIR}/sstate-cache + ${TOPDIR}/downloads). Custom
# overrides made bitbake's "fetched" stamps point at one
# location and do_unpack look in another when the GHA cache
# got partially populated from a previous workflow.
# GHA hosted runners only have ~30 GB free after the disk
# cleanup step; the full Weston image with vscode pulled in
# easily blows past that without rm_work, especially on
# do_unpack of the 200 MB VSCode tarball deep into the
# build. rm_work scrubs each recipe's workdir after
# do_package, reclaiming 5-15 GB.
INHERIT += "rm_work"
# Weston + ssh + VSCode + the launcher into the image.
IMAGE_INSTALL:append = " vscode vscode-weston-launcher wayland-utils"
IMAGE_FEATURES:append = " ssh-server-openssh debug-tweaks"
# Wire up testimage. Empty root password (debug-tweaks) lets
# OEQA ssh in as root with no key dance. testimage is added
# via IMAGE_CLASSES so it only inherits on image recipes
# (where it belongs), not on every recipe.
IMAGE_CLASSES += "testimage"
TEST_TARGET = "qemu"
TEST_SUITES = "ping ssh vscode_launcher"
TESTIMAGE_AUTO = "1"
# Headless qemu boot.
QB_GRAPHICS = "-vga none -nographic"
EOF
bitbake-layers add-layer "$GITHUB_WORKSPACE/meta-vscode"
bitbake-layers show-layers
- name: Build core-image-weston (with testimage auto-run)
env:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
run: |
set -eo pipefail
cd poky
source oe-init-build-env build
# TESTIMAGE_AUTO=1 means do_testimage fires at the end of
# build automatically, so this single bitbake invocation
# both builds the image AND runs the tests.
bitbake core-image-weston
- name: Show per-task logs from any failed recipe
if: failure()
run: |
# When bitbake fails, the underlying tool's stderr is captured
# at tmp/work/<arch>/<recipe>/<ver>/temp/log.do_<task>.<pid>.
# Dump every such log that's recent so the failing tool's
# actual error reaches the CI output.
find poky/build/tmp/work -path '*/temp/log.do_*' \
-newer poky/build/conf/local.conf 2>/dev/null \
| while read -r f; do
echo "==== $f ===="
tail -200 "$f"
echo
done
- name: Surface test results
if: always()
run: |
# OEQA's testimage emits a JUnit-style report under
# build/tmp/log/oeqa/. Surface the most recent one so the
# GHA log makes the failure obvious.
find poky/build/tmp/log/oeqa -name '*.xml' -newer poky/build/conf/local.conf \
-exec echo "==== {} ====" \; -exec cat {} \; 2>/dev/null || true
# And any captured console output.
find poky/build/tmp/log -name 'qemu_boot_log*' \
-exec echo "==== {} ====" \; -exec tail -120 {} \; 2>/dev/null || true