mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 02:00:19 +02:00
- checks: the runner's packages.microsoft.com apt source now 403s, failing `apt-get update` and with it "Install zsh"; tolerate the refresh error (Ubuntu's lists still update and the install still fails if it can't). - e2e: a failed quiet image build is rebuilt with the full log, but the script exited 2 even when that rebuild succeeded; only fail if it fails. - ArtworkTests: a timed-out lookup gives its resolver slot back from its own thread, which a busy macOS runner may schedule after the next test starts. Wait for every slot before each test, and always return slots a test took, so one late thread can't cascade into three failures. - release: tagged builds no longer re-upload the installers as workflow artifacts (they are attached to the release; the artifact finalize timed out on v0.3.0). Pull requests build installers only when the Electron app, the macOS helper it compiles, or the workflow changes. - checks and release: a newer push to a pull request cancels the older run. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
68 lines
2.7 KiB
Bash
Executable File
68 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env zsh
|
|
# Linux host with Docker: run the end-to-end tests against the fake Frame.
|
|
# Builds the fake Frame and host images (tests/fakeframe), starts them with
|
|
# docker compose, runs tests/e2e in the host container, prints the results
|
|
# and takes everything down again. Exits with the tests' status (2 if the
|
|
# harness itself didn't come up). See docs/testing.md.
|
|
#
|
|
# Usage: scripts/e2e.sh [TEST...] e.g. scripts/e2e.sh test_titles test_faults.Faults.test_disk_full
|
|
# Env: FAKEFRAME_BASE base image (default: archlinux:base, or Valve's Holo Core aarch64 on arm64)
|
|
# FAKEFRAME_KEEP=1 leave the containers running afterwards
|
|
set -uo pipefail
|
|
|
|
root=${0:A:h:h}
|
|
cd "$root" || exit 2
|
|
case $(uname -m) in
|
|
x86_64|amd64) base=archlinux:base ;;
|
|
aarch64|arm64) base=registry.gitlab.steamos.cloud/holo/holo-core-aarch64-preview/base-devel:latest ;;
|
|
*) print -u2 "No Arch Linux base image known for $(uname -m); set FAKEFRAME_BASE"; exit 2 ;;
|
|
esac
|
|
base=${FAKEFRAME_BASE:-$base}
|
|
compose=(docker compose -p fakeframe-e2e -f tests/fakeframe/compose.yaml)
|
|
started=$SECONDS
|
|
|
|
print "==> Building fakeframe-frame (from $base) and fakeframe-host"
|
|
# Quiet when it works; if a build fails, build again with the full log so CI shows why.
|
|
# That second build also rides out a flaky package mirror: only its failure is fatal.
|
|
build() { docker build -q "$@" >/dev/null || docker build --progress=plain "$@" || exit 2 }
|
|
build --build-arg BASE="$base" -t fakeframe-frame -f tests/fakeframe/Containerfile tests/fakeframe
|
|
build -t fakeframe-host -f tests/fakeframe/host.Containerfile tests/fakeframe
|
|
|
|
logs() {
|
|
print "\n==> Fake Frame logs"
|
|
$compose logs --no-color --tail 80 fakeframe
|
|
$compose exec -T fakeframe sh -c 'for f in /var/log/fakeframe/*.log; do echo "--- $f"; tail -n 40 "$f"; done' 2>/dev/null
|
|
print "\n==> ui/server.py log"
|
|
$compose exec -T host sh -c 'tail -n 80 /tmp/fakeframe-e2e-server.log' 2>/dev/null
|
|
}
|
|
|
|
finish() {
|
|
if [[ ${FAKEFRAME_KEEP:-0} == 1 ]]; then
|
|
print "==> Left running: ${(j: :)compose} exec host bash"
|
|
else
|
|
$compose down -v --remove-orphans >/dev/null 2>&1
|
|
fi
|
|
}
|
|
trap finish EXIT
|
|
|
|
$compose down -v --remove-orphans >/dev/null 2>&1
|
|
print "==> Starting the fake Frame and the host"
|
|
if ! $compose up -d --wait; then
|
|
logs
|
|
exit 2
|
|
fi
|
|
print "==> Up after $(( SECONDS - started )) s; running tests/e2e"
|
|
|
|
if (( $# )); then
|
|
args=(-v "$@")
|
|
else
|
|
args=(discover -v -s .)
|
|
fi
|
|
tests_started=$SECONDS
|
|
$compose exec -T -w /repo/tests/e2e host python3 -m unittest "${args[@]}"
|
|
rc=$?
|
|
(( rc == 0 )) || logs
|
|
print "\n==> tests/e2e: $([[ $rc == 0 ]] && echo passed || echo "FAILED (exit $rc)") in $(( SECONDS - tests_started )) s" \
|
|
"($(( SECONDS - started )) s with builds)"
|
|
exit $rc
|