Files
clide/ci/smoke_bundle.sh
T
jpmschweitzerandClaude 02cabcad35 add per-layer CI scripts and Gitea workflow (not activated)
ci/*.sh — shell-only, client-side-only so `git clone && make test`
works on any Linux or macOS dev box without network or shared state.
One script per testing layer so both Makefile targets and the CI
workflow can call them without duplicating logic. Rewrite of the
existing ci/test.sh to shell out to dart + flutter layers in one
pass (analyze, format, dart test, flutter test) plus five new
scripts for the other layers.

smoke_bundle.sh is the "tests passed but app doesn't start" gate
the user flagged: builds the Linux release bundle, runs it under
xvfb for 5s, fails on any non-SIGTERM exit — catches dynamic-linker
errors, missing-asset regressions, plugin-init crashes that widget
tests can't see.

.gitea/workflows/test.yml is a four-job pipeline (unit, integration,
startup-bundle, e2e) that shells out to the ci/*.sh scripts. NOT
activated — Gitea Actions has to be enabled in the instance settings
first. GitHub-Actions-compatible, so copying to .github/workflows/
is the whole migration if the repo moves.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-21 15:48:41 +02:00

54 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Startup regression gate: build the Linux release bundle and run it
# under xvfb for 5 seconds. Non-zero exit = the app crashed on boot.
#
# Catches: dynamic-linker errors, plugin-init failures, asset-not-bundled
# regressions, main-isolate unhandled errors surfacing pre-first-frame.
# These are exactly the class of regressions `make test` / widget tests
# cannot see because they never pump the real bundle.
set -euo pipefail
cd "$(dirname "$0")/.."
BUNDLE="app/build/linux/x64/release/bundle/clide_app"
echo "==> build linux release bundle"
(cd app && flutter build linux --release)
if [[ ! -x "$BUNDLE" ]]; then
echo "smoke: bundle not found at $BUNDLE" >&2
exit 2
fi
echo "==> launching under xvfb for 5s"
if ! command -v xvfb-run >/dev/null 2>&1; then
echo "smoke: xvfb-run is required (install via: apt-get install xvfb)" >&2
exit 2
fi
# Wrap with `timeout` so a healthy daemon-less app gets SIGTERM cleanly.
# Expected: SIGTERM (exit 143) — the app stayed up the whole time.
# Anything else: crash.
set +e
xvfb-run -a -s "-screen 0 1280x720x24" timeout --signal=TERM 5 "$BUNDLE"
exit_code=$?
set -e
# `timeout` exits 124 when it sends SIGTERM + the process terminates
# gracefully, 143 when terminated without graceful cleanup, or the
# app's own exit code if it self-exited first.
case $exit_code in
124|143)
echo "==> smoke: app stayed up for 5s, killed by timeout (healthy)"
exit 0
;;
0)
echo "==> smoke: app exited cleanly before timeout (unusual; check main.dart)" >&2
exit 0
;;
*)
echo "==> smoke: app exited with $exit_code before timeout (CRASH)" >&2
exit 1
;;
esac