qemu-runtime #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| - name: Cache poky checkout | |
| uses: actions/cache@v4 | |
| with: | |
| path: poky | |
| key: poky-scarthgap-runtime-v1 | |
| restore-keys: poky-scarthgap- | |
| - 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 sstate | |
| # GHA caches cap at 10 GB. Yocto sstate for a full Weston | |
| # image is much larger than that, so we can't cache it whole. | |
| # Cache what fits and let cold cells rebuild. | |
| uses: actions/cache@v4 | |
| with: | |
| path: sstate-cache | |
| key: sstate-scarthgap-weston-${{ hashFiles('meta-vscode/recipes-devtools/vscode/*.bb') }} | |
| restore-keys: | | |
| sstate-scarthgap-weston- | |
| sstate-scarthgap- | |
| - name: Cache downloads | |
| uses: actions/cache@v4 | |
| with: | |
| path: downloads | |
| key: downloads-scarthgap-weston-${{ hashFiles('meta-vscode/recipes-devtools/vscode/*.bb') }} | |
| restore-keys: | | |
| downloads-scarthgap-weston- | |
| downloads-scarthgap- | |
| - 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" | |
| SSTATE_DIR ?= "${TOPDIR}/../../sstate-cache" | |
| DL_DIR ?= "${TOPDIR}/../../downloads" | |
| # 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: 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 |