Files
bfe-core1106-sdk/.github/workflows/ci.yml
T
BFE EngineeringandClaude Opus 5.5 820af4baaa
ci / test (push) Successful in 7s
ci / bench (push) Successful in 9s
ci / mcdc (push) Successful in 22s
ci / patches-apply (push) Successful in 50s
ci / prune-artifacts (push) Skipped
ci / kernel-build (push) Skipped
ci / qemu-tools (push) Failing after 27s
ci / quality (push) Successful in 1m17s
ci / badges (push) Skipped
ci / kernel-symbols (push) Successful in 7m7s
ci / test (pull_request) Successful in 9s
ci / bench (pull_request) Successful in 11s
ci / mcdc (pull_request) Successful in 13s
ci / patches-apply (pull_request) Successful in 54s
ci / qemu-tools (pull_request) Failing after 11s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / quality (pull_request) Successful in 1m27s
ci / badges (pull_request) Skipped
ci / kernel-symbols (pull_request) Successful in 4m10s
qemu: let a job without the cross compiler use a prebuilt panel BusyBox (flare-edge#2210)
The flare-edge flow jobs get the rig BusyBox from the image build job's
artifact and have no cross compiler, so RIG_BUSYBOX=panel, which always ran
build-busybox.sh, could not be used there.

- qemu/lib.sh: qemu_busybox_panel_inputs, one sha256 over the source pin
  and every committed input under qemu/busybox/ (no compiler). With
  RIG_BUSYBOX=panel and BUSYBOX set, qemu_get_busybox takes that binary only
  when BUSYBOX.inputs equals the value for this tree; otherwise it fails
  closed. The source pin moved here from build-busybox.sh.
- qemu/build-busybox.sh writes <binary>.inputs next to the binary (also on
  the up-to-date path) and removes a stale one before a rebuild.
- busybox-panel-test.sh: missing, foreign and matching .inputs, a missing
  binary, and a config or patch edit changing the inputs.
- CI qemu-tools: a panel initramfs from the prebuilt binary.

Refs flare-edge#2210

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
2026-10-29 08:34:45 -06:00

600 lines
29 KiB
YAML

# bfe-core1106-sdk CI.
#
# Policy (mirrors flare-edge): only GitHub-owned actions get the repo token; the one
# third-party helper (taiki-e/install-action) is pinned and never handed a token.
# Every job runs on GitHub-hosted runners: no self-hosted runner may be reachable
# from this repo's workflows (ADR-0007: public-repo fork PRs would otherwise be
# able to run code on private infrastructure). kernel-build is dispatch-only.
name: ci
on:
push:
paths-ignore: ['.github/badges/**']
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
# Least privilege by default: every job gets a read-only token; only `badges`
# (which commits rendered SVGs) overrides this with contents: write below.
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 25
outputs:
passed: ${{ steps.result.outputs.passed }}
coverage: ${{ steps.result.outputs.coverage }}
steps:
- uses: actions/checkout@v4
- name: cargo test (all crates)
run: |
set -o pipefail
: > /tmp/test.log
for d in sim tools/config-lint qemu/rs485-bridge qemu/tests/clockprobe; do
echo "== cargo test in $d ==" | tee -a /tmp/test.log
( cd "$d" && cargo test --locked ) 2>&1 | tee -a /tmp/test.log
done
- name: coverage (cargo-llvm-cov on sim)
run: rustup component add llvm-tools-preview
- uses: taiki-e/install-action@b6ff580856c41316412a0b9b60540fbc6f8c82cc # v2.86.7
with:
tool: cargo-llvm-cov
- name: run coverage
working-directory: sim
run: cargo llvm-cov --locked --json --summary-only --output-path /tmp/cov.json
- name: parse results
id: result
run: |
passed=$(grep -oE '[0-9]+ passed' /tmp/test.log | awk '{s+=$1} END{print s+0}')
pct=$(python3 -c 'import json;print("%.0f"%json.load(open("/tmp/cov.json"))["data"][0]["totals"]["lines"]["percent"])')
echo "passed=$passed" >> "$GITHUB_OUTPUT"
echo "coverage=$pct" >> "$GITHUB_OUTPUT"
echo "tests passed: $passed | sim line coverage: ${pct}%"
mcdc:
# 100% MC/DC (condition coverage) enforced on every Tier-1 driver harness.
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: install gcc-14
run: sudo apt-get update -qq && sudo apt-get install -y -qq gcc-14
- name: enforce 100% MC/DC on drivers/*/test
run: |
fail=0; ran=0
for t in drivers/*/test; do
[ -f "$t/Makefile" ] || continue
ran=1
echo "== MC/DC: $t =="
make -C "$t" check CC=gcc-14 GCOV=gcov-14 || fail=1
done
[ "$ran" = 1 ] || { echo "no driver MC/DC harnesses found"; exit 1; }
exit $fail
bench:
# Smoke-run the sim micro-benchmarks and emit the ns/op trend JSON. Regression
# gating against stored history is future work (no flare-edge pattern to copy).
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: run sim benchmarks
working-directory: sim
run: |
cargo bench --locked --bench sim_bench 1> bench.txt 2> bench.json
echo "== timings =="; cat bench.txt
echo "== trend json =="; grep '"bench"' bench.json
- name: run rs485-bridge benchmarks
working-directory: qemu/rs485-bridge
run: |
cargo bench --locked --bench bridge_bench 1> bench.txt 2> bench.json
echo "== timings =="; cat bench.txt
echo "== trend json =="; grep '"bench"' bench.json
qemu-tools:
# The qemu/ device-sim build tooling must stay healthy on a plain hosted
# runner: shellcheck the scripts, build the initramfs (pinned busybox,
# fail-closed sha), and build the A/B disk image (unprivileged mkfs -d).
# Booting needs a zImage and therefore lives in kernel-build's smoke step.
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: shellcheck qemu scripts
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq shellcheck
shellcheck -x qemu/*.sh qemu/tests/*.sh build/*.sh \
qemu/rootfs/etc/warden-lib.sh qemu/rootfs/etc/rc \
qemu/rootfs/sbin/init qemu/rootfs/init tests/mk-bootimg/*.sh \
tests/fetch-vendor/*.sh tests/fetch-buildroot-tarball/*.sh \
tests/fetch-kernel-tarball/*.sh tests/unpack-buildroot/*.sh
- name: qemu init shellcheck regression test
run: bash tests/qemu-init/run-init-shellcheck-tests.sh
- name: cache apt archives (python3-pil)
# Same cost class as the busybox binary cached below: a system package
# plus its libjpeg/libpng transitive deps, downloaded fresh on every
# push otherwise.
uses: actions/cache@v4
with:
path: /var/cache/apt/archives
key: apt-archives-python3-pil-${{ runner.os }}
- name: ui-drive driver and image tools (offline)
# qmp.py's drive() with QMP and the control channel faked, plus
# imgtools' self-test: the per-step ok/fail/fatal contract and the
# region reference math, no VM needed.
run: |
sudo apt-get install -y -qq python3-pil
python3 qemu/tests/imgtools.py selftest
python3 qemu/tests/test_qmp_drive.py
- name: imgtools bench (smoke, printed for trend-watching)
# Same pattern as the sim/rs485-bridge bench job above: no stored
# baseline yet, just a number in the log so a phash/structural
# regression (DCT size, downscale filter, occupancy thresholds)
# is visible instead of only showing up as an unexplained slower
# flow run later.
run: python3 qemu/tests/imgtools.py bench
- name: mk-bootimg probe regression tests
# Guards issue #17 (mkimage's non-zero exit sinking the probe's grep
# pipeline under set -o pipefail) on every push/PR, not only on the
# next workflow_dispatch that happens to exercise mk-bootimg.sh for
# real via kernel-build.
run: bash tests/mk-bootimg/run-probe-tests.sh
- name: run.sh argv ordering regression test
# Pins the CTL-before-RS485 pci-serial argv order that
# rootfs/sbin/init's ttyS0-vs-ttyS1 alias depends on: a swap here
# reproduces run.sh:131-133's own incident, Modbus frames landing
# on the debug channel. All offline (a stub qemu-system-arm on
# PATH), so it runs on every push/PR, not only a real boot.
run: bash qemu/tests/run-sh-args-test.sh
- name: rig init honours reboot/poweroff/halt (#5)
run: bash qemu/tests/init-power-signals-test.sh
- name: rig init daemon order matches the panel (flare-edge#348)
run: bash qemu/tests/init-daemon-order-test.sh
- name: rig bus starts when the payload carries a broker (flare-edge#1754)
# A stub broker stands in for mosquitto (the runner has none), and
# once more under busybox sh, the rig's own shell.
run: |
bash qemu/tests/init-rig-bus-test.sh
if command -v busybox >/dev/null; then
WARDEN_TEST_SH="busybox sh" bash qemu/tests/init-rig-bus-test.sh
fi
- name: rig control bridge waits out a slow UI and reaches the test hook (flare-edge#1448, #2054)
# Once more under busybox sh, the rig's own shell.
run: |
bash qemu/tests/ctl-bridge-test.sh
if command -v busybox >/dev/null; then
WARDEN_TEST_SH="busybox sh" bash qemu/tests/ctl-bridge-test.sh
fi
- name: rig init boots through the shipped init chain (flare-edge#2210)
# warden_init_chain against stub scripts and the warden.initchain
# wiring in sbin/init; once more under busybox sh, the rig's own shell.
run: |
bash qemu/tests/init-chain-test.sh
if command -v busybox >/dev/null; then
WARDEN_TEST_SH="busybox sh" bash qemu/tests/init-chain-test.sh
fi
- name: rig debug shell works without cttyhack (flare-edge#2210)
# The panel's BusyBox has no cttyhack; warden.shell then opens the
# console tty itself. Once more under busybox sh, the rig's own shell.
run: |
bash qemu/tests/console-shell-test.sh
if command -v busybox >/dev/null; then
WARDEN_TEST_SH="busybox sh" bash qemu/tests/console-shell-test.sh
fi
- name: panel BusyBox config and build helpers (flare-edge#2210)
# panel.config carries the image's applet patch, the rig fragment only
# changes linking, Kconfig rewrites and applet drift are caught: offline.
run: bash qemu/tests/busybox-panel-test.sh
- name: ui-drive.sh / ui-shot.sh UI start wait regression test (flare-edge#2295)
# The console line that means "UI started" differs between a direct
# start and a shipped init chain boot; every marker is checked
# against sbin/init, and a chain failure fails at once.
run: bash qemu/tests/ui-start-test.sh
- name: mkimage.sh ROOTFS_OVERLAY regression test (flare-edge#2210)
# The panel's scripts land in both slots with their modes; an overlay
# reaching outside etc/ and usr/, or holding a symlink, writes no image.
run: bash qemu/tests/rootfs-overlay.sh
- name: mkimage.sh SEED_DIR regression test
# Only ui-drive.sh --seed (a real VM boot) exercises this hook
# otherwise; this builds the same unprivileged mkfs.ext4 image and
# reads it back with debugfs, no VM needed.
run: bash qemu/tests/seed-dir.sh
- name: mkimage.sh PAYLOAD_DIR regression test (flare-edge#2054)
# A run's own payload set (the hook set) lands in both slots, the
# default still reads qemu/payload, and ui-drive.sh checks the same
# directory; images read back with debugfs, no VM.
run: bash qemu/tests/payload-dir.sh
- name: qemu_stage_rootfs permission regression test
# Git tracks only the executable bit, so a fresh checkout can land
# the source etc/shadow world-readable under a permissive umask;
# this pins the staged copy at 0600 regardless of the source mode.
run: bash qemu/tests/stage-rootfs-perms.sh
- name: fetch-vendor regression tests
# --check state machine (MISSING/OK/DRIFTED), --help, and the
# clone stall guard, against local throwaway repos: no network.
run: bash tests/fetch-vendor/run-fetch-vendor-tests.sh
- name: fetch-buildroot-tarball regression tests
# Retry-on-mismatch, cleanup, and the already-verified
# short-circuit, against a fake curl on PATH: no network.
run: bash tests/fetch-buildroot-tarball/run-fetch-buildroot-tarball-tests.sh
- name: fetch-kernel-tarball regression tests
# Bounded curl and no partial tarball after a failed fetch (#1588),
# against a fake curl on PATH: no network.
run: bash tests/fetch-kernel-tarball/run-fetch-kernel-tarball-tests.sh
- name: QEMU busybox fetch regression tests
# Retry on a bad sha256, the cached copy, and a server that answers
# and then stalls (#1588), against local listeners: no network.
run: bash qemu/tests/busybox-fetch.sh
- name: unpack-buildroot regression tests
# Fresh unpack, leave-existing-tree-alone, and every refusal path
# (unpatched selectors, bad tarball, half-present tree, failed
# fetch), against a stub fetch script: no network (issue #4).
run: bash tests/unpack-buildroot/run-unpack-buildroot-tests.sh
- name: mk-bootimg boot.img validation regression tests
# Guards issue #22 (a missing/erroring fdtget silently skipping the
# data-position check) plus the FIT metadata and per-image
# data-position %512 checks and the embedded-data-FIT check.
run: bash tests/mk-bootimg/run-boot-img-validate-tests.sh
- name: mk-bootimg --help regression test
# Pins --help against its own header comment so a hardcoded line
# range can't silently start printing code again the next time the
# header grows or shrinks (the bug fetch-vendor.sh's --help had).
run: bash tests/mk-bootimg/run-help-tests.sh
- name: qemu-tools CI wiring regression test
# Catches a regression test shipping in this job without this job
# ever calling it -- the exact gap run-probe-tests.sh sat in before
# the step above wired it in.
run: bash tests/mk-bootimg/run-ci-wiring-tests.sh
- name: cache pinned busybox
uses: actions/cache@v4
with:
path: qemu/out/busybox-armv7l
key: busybox-armv7l-${{ hashFiles('qemu/busybox.sha256') }}
- name: build initramfs
run: bash qemu/mkinitramfs.sh
- name: build A/B disk image
run: bash qemu/mkimage.sh
- name: cache panel BusyBox source
uses: actions/cache@v4
with:
path: qemu/out/busybox-1.37.0.tar.bz2
key: busybox-src-1.37.0
- name: build the panel BusyBox and check it against the bench capture (flare-edge#2210)
# The image's BusyBox version, applet config and Buildroot patches,
# linked static (qemu/build-busybox.sh). Its applet list and every
# applet's --help must equal the panel's own binary's (captured on
# bench a), run here through qemu-user. Then an initramfs with it.
run: |
sudo apt-get install -y -qq gcc-arm-linux-gnueabihf qemu-user
bash qemu/build-busybox.sh
QEMU_USER="qemu-arm" bash qemu/tests/busybox-panel-help.sh
RIG_BUSYBOX=panel bash qemu/mkinitramfs.sh
# A job without the cross compiler takes the binary as BUSYBOX,
# checked by its .inputs (flare-edge flow jobs).
RIG_BUSYBOX=panel BUSYBOX=qemu/out/busybox-armv7l-panel bash qemu/mkinitramfs.sh
kernel-symbols:
# The symbol gate (rebuild M0, kernel_symbols_exist): expand the real
# configuration (pristine tarball + patch series + warden_defconfig) and
# assert build/required-symbols.txt and probe-symbols.txt against the final
# .config, without compiling. olddefconfig drops a symbol that does not exist
# or whose dependencies are unmet without a word; this is what turns that
# into a red check on every push, in seconds rather than the ~9 minutes of a
# kernel build. The generic arm cross toolchain is enough: only the compiler
# version text of the configuration depends on it.
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: offline symbol-list tests
run: bash tests/required-symbols/run-required-symbols-tests.sh
- name: install cross toolchain + kernel config deps
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq gcc-arm-linux-gnueabihf bc bison flex libssl-dev
- name: provision `python` (SDK quirk, the build calls bare python)
run: |
mkdir -p "$RUNNER_TEMP/bin"
ln -sf "$(command -v python3)" "$RUNNER_TEMP/bin/python"
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: cache pristine kernel tarball
uses: actions/cache@v4
with:
path: ~/linux-6.18.46.tar.xz
key: linux-6.18.46-tarball
- name: expand the configuration and assert the symbols
env:
# WORK must be OUTSIDE the repo checkout (git apply, issue #1).
WORK: ${{ runner.temp }}/kcfg-work
CONFIG_OUT: ${{ runner.temp }}/final.config
CROSS_COMPILE: arm-linux-gnueabihf-
WARDEN_CONFIG_ONLY: "1"
run: |
export KERNEL_TARBALL="$HOME/linux-6.18.46.tar.xz"
bash build/build-kernel.sh
test -s "$CONFIG_OUT" && test -s "$CONFIG_OUT.sha256"
# the sidecar is the sha256 of the file it sits beside
test "$(sha256sum "$CONFIG_OUT" | cut -d' ' -f1)" = "$(cat "$CONFIG_OUT.sha256")"
- name: the expansion is deterministic (same inputs, same digest)
env:
WORK: ${{ runner.temp }}/kcfg-work-2
CONFIG_OUT: ${{ runner.temp }}/final-2.config
CROSS_COMPILE: arm-linux-gnueabihf-
WARDEN_CONFIG_ONLY: "1"
run: |
export KERNEL_TARBALL="$HOME/linux-6.18.46.tar.xz"
bash build/build-kernel.sh
cmp "${{ runner.temp }}/final.config" "$CONFIG_OUT"
- name: the digest does not depend on the host python (issue #19)
env:
CROSS_COMPILE: arm-linux-gnueabihf-
run: |
export KERNEL_TARBALL="$HOME/linux-6.18.46.tar.xz"
bash tests/required-symbols/run-config-determinism-tests.sh
patches-apply:
# The RV1106 series must apply cleanly onto pristine linux-6.18.46.
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: cache pristine kernel tarball
uses: actions/cache@v4
with:
path: ~/linux-6.18.46.tar.xz
key: linux-6.18.46-tarball
- name: fetch + verify pristine (shared fail-closed fetcher)
run: bash build/fetch-kernel-tarball.sh "$HOME/linux-6.18.46.tar.xz"
- name: apply the series in order
run: |
tar -C /tmp -xf ~/linux-6.18.46.tar.xz
for p in patches/*.patch; do
git -C /tmp/linux-6.18.46 apply --whitespace=nowarn "$GITHUB_WORKSPACE/$p" \
&& echo "applied $p" || { echo "FAILED to apply $p"; exit 1; }
done
echo "full series applied cleanly onto pristine 6.18.46"
- name: arm32 vDSO stays off the virtual counter (bfe-core1106-sdk#35)
# The kernel times on the physical counter and the firmware leaves
# CNTVOFF non-zero, so the vDSO clock must stay off: the DT property and
# the arm_arch_timer.c fallback both have to survive in the patched tree.
run: |
bash tests/arch-timer/run-check-vdso-counter-tests.sh
python3 tests/arch-timer/check-vdso-counter.py /tmp/linux-6.18.46
# Automatic artifact GC (mirrors flare-edge). An exceeded account-wide Actions
# storage quota blocks ALL new runs (startup_failure), not just uploads, so
# before a new kernel artifact is uploaded, drop older kernel-rv1106 artifacts
# beyond the newest few: storage stays bounded across dispatches. gh + the
# built-in token (no third-party action); needs actions:write to delete.
# Best-effort: it never fails the run, so it can't block the build that needs it.
prune-artifacts:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
actions: write
steps:
- name: Keep only the newest few kernel artifacts
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
KEEP: "3"
run: |
ids=$(gh api --paginate "repos/$REPO/actions/artifacts?per_page=100" \
--jq "[.artifacts[] | select(.name==\"kernel-rv1106\")]
| sort_by(.created_at) | reverse | .[$KEEP:] | .[].id" \
2>/dev/null) || { echo "list failed; skipping"; exit 0; }
n=0
for id in $ids; do
if gh api -X DELETE "repos/$REPO/actions/artifacts/$id" 2>/dev/null; then
n=$((n + 1)); echo "pruned artifact $id"
fi
done
echo "pruned $n old kernel artifact(s); kept newest $KEEP"
exit 0
kernel-build:
# Full hermetic build on a GitHub-hosted runner (ADR-0007; supersedes the
# self-hosted half of ADR-0004: a self-hosted runner must never be reachable
# from a public repo's workflows). Manual-dispatch by design: a full kernel
# build is heavy; trigger via `gh workflow run ci.yml` / the Actions UI.
if: github.event_name == 'workflow_dispatch'
needs: [prune-artifacts]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: install cross toolchain + kernel build deps + qemu
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq gcc-arm-linux-gnueabihf qemu-system-arm \
cpio bc bison flex libssl-dev ccache
- name: provision `python` (SDK quirk, the build calls bare python)
run: |
mkdir -p "$RUNNER_TEMP/bin"
ln -sf "$(command -v python3)" "$RUNNER_TEMP/bin/python"
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: cache pristine kernel tarball
uses: actions/cache@v4
with:
path: ~/linux-6.18.46.tar.xz
key: linux-6.18.46-tarball
# Ephemeral runners rebuild the whole tree every dispatch (~9 min of
# compile); ccache recovers most of it for an unchanged/lightly-changed
# series. Keyed on the config + patches so a real change misses cleanly.
- name: cache ccache
uses: actions/cache@v4
with:
path: ~/.ccache
key: kbuild-ccache-${{ hashFiles('build/warden_defconfig', 'patches/*.patch') }}
restore-keys: kbuild-ccache-
- name: build zImage + rv1106-warden.dtb
env:
# WORK must be OUTSIDE the repo checkout: build-kernel.sh applies the patch
# series with `git apply`, which silently ignores out-of-subdir paths when
# run inside another git repo (issue #1). $RUNNER_TEMP is outside the checkout.
WORK: ${{ runner.temp }}/kbuild-out
# The kernel is freestanding; the generic arm cross toolchain links it.
CROSS_COMPILE: arm-linux-gnueabihf-
WARDEN_CCACHE: 1
CCACHE_DIR: /home/runner/.ccache
# Matched module set for the out-of-tree wifi/BT drivers (issue #4:
# a stale 5.10 .ko was all the panel had). Full `make modules` runs
# (zImage alone emits no Module.symvers); only these dirs' .ko files
# are collected/uploaded.
WARDEN_MODULES_COLLECT: drivers/net/wireless/aic8800
# KERNEL_TARBALL is exported from the SHELL so $HOME expands. A literal
# `~` in a YAML env: value is never tilde-expanded and broke every
# dispatch until caught in review.
run: |
export KERNEL_TARBALL="$HOME/linux-6.18.46.tar.xz"
bash build/build-kernel.sh
ccache -s | head -4
# Boot smoke under QEMU: the zImage this job just built must reach the
# initramfs sentinel on -M virt (verified 2026-08-29: the canonical
# config boots virt as-is). FAIL-CLOSED on a missing qemu-system-arm.
- name: boot smoke (qemu-system-arm -M virt)
run: |
bash qemu/mkinitramfs.sh
bash qemu/tests/boot-smoke.sh \
"$RUNNER_TEMP/kbuild-out/linux-6.18.46/arch/arm/boot/zImage"
# Once more with the panel's BusyBox (RIG_BUSYBOX=panel, flare-edge#2210).
OUT="$RUNNER_TEMP/panel-rig" RIG_BUSYBOX=panel bash qemu/mkinitramfs.sh
bash qemu/tests/boot-smoke.sh \
"$RUNNER_TEMP/kbuild-out/linux-6.18.46/arch/arm/boot/zImage" \
"$RUNNER_TEMP/panel-rig/initramfs.cpio.gz"
# Best-effort: the build IS the gate. Uploading the zImage/dtb to GitHub
# artifact storage can fail on an account-wide storage-quota hit (recalculated
# every 6-12h) that has nothing to do with this build. Don't red-X a good
# kernel build over it.
- uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: kernel-rv1106
path: |
${{ runner.temp }}/kbuild-out/linux-6.18.46/arch/arm/boot/zImage
${{ runner.temp }}/kbuild-out/linux-6.18.46/arch/arm/boot/dts/rockchip/rv1106-warden.dtb
${{ runner.temp }}/kbuild-out/modules-out/*.ko
# Short so kernel images self-expire instead of piling into the
# account-wide storage quota; the prune-artifacts job above is the
# active bound, this is the backstop.
retention-days: 5
quality:
# Self-hosted Codacy-style grade: a linter battery feeds
# tools/quality/score.py (SQALE debt ratio + a separate security axis;
# thresholds documented in the script). No external assessment service;
# the badge is rendered and committed by the badges job.
runs-on: ubuntu-latest
timeout-minutes: 20
outputs:
grade: ${{ steps.score.outputs.grade }}
color: ${{ steps.score.outputs.color }}
steps:
- uses: actions/checkout@v4
- name: install analyzers
# The job image's Python is PEP 668 "externally managed", so a plain
# pip install is refused. GitHub's hosted runners set this same
# variable; here every job runs in a throwaway container on a
# throwaway VM (the GARM runners), so nothing outlives the job.
env:
PIP_BREAK_SYSTEM_PACKAGES: "1"
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq cppcheck shellcheck
pip install --quiet lizard ruff
sudo env "PATH=$PATH" npm install --silent -g jscpd
curl -fsSL -o /tmp/scc.tar.gz \
https://github.com/boyter/scc/releases/download/v3.6.0/scc_Linux_x86_64.tar.gz
sudo tar -C /usr/local/bin -xzf /tmp/scc.tar.gz scc
rustup component add clippy
- uses: taiki-e/install-action@b6ff580856c41316412a0b9b60540fbc6f8c82cc # v2.86.7
with:
tool: cargo-audit
- name: collect linter outputs
run: |
Q="$RUNNER_TEMP/qual"; mkdir -p "$Q"
scc --format json \
--exclude-dir .git,target,patches,kernel,docs/workflows,.github/badges \
. > "$Q/scc.json"
: > "$Q/clippy.jsonl"
for d in sim tools/config-lint qemu/rs485-bridge qemu/tests/clockprobe; do
( cd "$d" && cargo clippy --locked --all-targets --message-format=json \
2>/dev/null >> "$Q/clippy.jsonl" )
( cd "$d" && cargo audit --json -q > "$Q/audit-$(basename "$d").json" )
done
shellcheck -f json1 qemu/*.sh qemu/tests/*.sh build/*.sh \
qemu/rootfs/init qemu/rootfs/etc/rc qemu/rootfs/sbin/init \
> "$Q/shellcheck.json" || true
cppcheck --enable=warning,style,performance,portability --inline-suppr \
--xml drivers/ 2> "$Q/cppcheck.xml"
lizard -C 10 --csv sim/src qemu/rs485-bridge/src tools/config-lint/src \
drivers/ tools/flowgen.py qemu/tests/clockprobe/src > "$Q/lizard.csv"
ruff check --output-format=json tools/ qemu/ > "$Q/ruff.json" || true
jscpd --silent --reporters json --output "$Q" \
--pattern '**/*.{rs,c,h,sh,py}' \
--ignore '**/target/**,**/patches/**,**/kernel/**' .
- name: score
id: score
run: |
python3 tools/quality/score.py "$RUNNER_TEMP/qual" \
--out "$RUNNER_TEMP/qual/quality.json"
J="$RUNNER_TEMP/qual/quality.json"
echo "grade=$(python3 -c "import json,sys; print(json.load(open(sys.argv[1]))['grade'])" "$J")" >> "$GITHUB_OUTPUT"
echo "color=$(python3 -c "import json,sys; print(json.load(open(sys.argv[1]))['badge_color'])" "$J")" >> "$GITHUB_OUTPUT"
- name: security gate
run: python3 tools/quality/score.py "$RUNNER_TEMP/qual" --gate-security C
- uses: actions/upload-artifact@v4
with:
name: quality-report
path: ${{ runner.temp }}/qual/quality.json
retention-days: 30
badges:
needs: [test, quality]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: install tools
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq cloc
pip install --quiet anybadge
- name: render badges
# Rendered locally with anybadge: the committed SVG must not depend
# on any external service, at view time or at render time.
env:
PASSED: ${{ needs.test.outputs.passed }}
COVERAGE: ${{ needs.test.outputs.coverage }}
GRADE: ${{ needs.quality.outputs.grade }}
QCOLOR: ${{ needs.quality.outputs.color }}
run: |
mkdir -p .github/badges
loc=$(cloc --quiet --json --exclude-dir=target,build,build-target,patches,data,docs . \
| python3 -c 'import sys,json; print(json.load(sys.stdin)["SUM"]["code"])')
col='#fe7d37'; [ "${COVERAGE:-0}" -ge 60 ] && col='#dfb317'; [ "${COVERAGE:-0}" -ge 80 ] && col='#4c1'
anybadge --overwrite --label="lines of code" --value="$loc" --color='#007ec6' \
--file=.github/badges/loc.svg
anybadge --overwrite --label=tests --value="${PASSED} passing" --color='#4c1' \
--file=.github/badges/tests.svg
anybadge --overwrite --label=coverage --value="${COVERAGE}%" --color="$col" \
--file=.github/badges/coverage.svg
anybadge --overwrite --label="code quality" --value="$GRADE" --color="$QCOLOR" \
--file=.github/badges/quality.svg
- name: commit badges
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .github/badges/*.svg
if ! git diff --cached --quiet; then
git commit -m "ci: update badges [skip ci]"
git push
fi