-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (177 loc) · 7.9 KB
/
Copy pathqemu-runtime.yml
File metadata and controls
194 lines (177 loc) · 7.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
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) that does NOT fit inside
# the GitHub-hosted runner's hard 6-hour job-runtime cap from a cold
# sstate -- repeated weekly cron runs hit the cap and got cancelled.
# Until we wire up a self-hosted runner (e.g. fio) with persistent
# sstate, this workflow is manual-dispatch only.
on:
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: |
# See ci.yml's matching step for why this uses a force refspec
# plus a re-clone fallback. Upstream-branch rebases otherwise
# poison the cached checkout.
set -eo pipefail
clone_fresh() {
rm -rf poky
git clone --depth 1 --branch scarthgap \
https://git.yoctoproject.org/poky poky
}
if [ ! -d poky/.git ]; then
clone_fresh
else
if ! git -C poky fetch --depth 1 origin \
"+scarthgap:refs/remotes/origin/scarthgap"; then
echo "fetch failed; falling back to fresh clone"
clone_fresh
else
git -C poky checkout -B scarthgap refs/remotes/origin/scarthgap
fi
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