ci: add headless smoke + screenshot test for the bar
Launch the real Waybar binary inside a headless, software-rendered sway compositor and verify it actually runs and renders — something the unit tests and build jobs never do. - test/smoke/run.sh: boots sway (WLR_BACKENDS=headless, pixman), starts waybar, asserts it stays alive with no fatal log, optionally grabs a screenshot with grim - level 1: real modules (clock/cpu/memory/disk) load without crashing - level 2: deterministic config is screenshotted and checked to be non-blank - level 3: screenshot compared to test/smoke/reference.png (fuzz 8%, 800px tolerance); screenshot + diff uploaded as artifacts - .github/workflows/smoke.yml runs it on push/PR The reference image must be blessed from a CI artifact (see test/smoke/README.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
name: smoke
|
||||
|
||||
# Launch the real Waybar binary inside a headless sway compositor and verify it
|
||||
# starts, renders, and matches a reference screenshot. Complements the unit
|
||||
# tests and build jobs, which never actually run the bar.
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
smoke:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --no-install-recommends -y \
|
||||
sway grim imagemagick fonts-dejavu-core \
|
||||
meson ninja-build g++ pkg-config scdoc wayland-protocols \
|
||||
gobject-introspection libdbusmenu-gtk3-dev libevdev-dev libfmt-dev \
|
||||
libgirepository1.0-dev libgtk-3-dev libgtkmm-3.0-dev libinput-dev \
|
||||
libjsoncpp-dev libmpdclient-dev libnl-3-dev libnl-genl-3-dev \
|
||||
libpulse-dev libsigc++-2.0-dev libspdlog-dev libwayland-dev \
|
||||
upower libxkbregistry-dev libxkbcommon-dev
|
||||
|
||||
- name: Build & install Waybar
|
||||
run: |
|
||||
meson setup build -Dman-pages=disabled
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
# --- Level 1: smoke with real modules ---
|
||||
- name: Smoke — real modules load without crashing
|
||||
run: ./test/smoke/run.sh test/smoke/modules-config.jsonc
|
||||
|
||||
# --- Level 1 + 2: launch deterministic config and screenshot ---
|
||||
- name: Launch + screenshot (deterministic config)
|
||||
run: ./test/smoke/run.sh test/smoke/config.jsonc test/smoke/style.css bar.png
|
||||
|
||||
# --- Level 2: the bar actually rendered something ---
|
||||
- name: Check the bar is not blank
|
||||
run: |
|
||||
sd=$(convert bar.png -crop 1920x30+0+0 +repage -colorspace Gray \
|
||||
-format '%[fx:standard_deviation]' info:)
|
||||
echo "bar strip stddev = $sd"
|
||||
awk "BEGIN{ exit !($sd > 0.01) }" || {
|
||||
echo "::error::the top bar strip looks blank — Waybar rendered nothing"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# --- Level 3: golden comparison against the committed reference ---
|
||||
- name: Compare against reference screenshot
|
||||
run: |
|
||||
if [ -f test/smoke/reference.png ]; then
|
||||
ae=$(compare -metric AE -fuzz 8% test/smoke/reference.png bar.png diff.png 2>&1 || true)
|
||||
ae=$(printf '%s' "$ae" | grep -oE '^[0-9]+' || echo 0)
|
||||
echo "differing pixels (fuzz 8%): $ae"
|
||||
if [ "$ae" -gt 800 ]; then
|
||||
echo "::error::visual regression: $ae pixels differ from the reference (threshold 800). See the 'diff.png' artifact."
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ within tolerance"
|
||||
else
|
||||
echo "::warning::No reference image yet. Download the 'waybar-screenshot' artifact from this run and commit bar.png as test/smoke/reference.png to enable golden comparison."
|
||||
fi
|
||||
|
||||
- name: Upload screenshots
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: waybar-screenshot
|
||||
path: |
|
||||
bar.png
|
||||
diff.png
|
||||
if-no-files-found: warn
|
||||
Reference in New Issue
Block a user