From 96c1574ce4ebd94f2510c936396ae2f281655b99 Mon Sep 17 00:00:00 2001 From: astrovm <5521045+astrovm@users.noreply.github.com> Date: Sat, 21 Nov 2026 08:03:25 -0300 Subject: [PATCH 1/7] fix(appimage): bundle the X11 libraries winit opens at runtime --- .github/workflows/ci.yml | 12 ++--- Cargo.lock | 2 +- Cargo.toml | 2 +- build-aux/appimage/build-appimage.sh | 18 ++++++- build-aux/appimage/build-container.sh | 1 + build-aux/appimage/test-window.sh | 50 +++++++++++++++++++ ...thub.astrovm.AdventureMods.metainfo.xml.in | 5 ++ fuzz/Cargo.lock | 2 +- 8 files changed, 81 insertions(+), 11 deletions(-) create mode 100755 build-aux/appimage/test-window.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d890556..3eba807 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -260,12 +260,12 @@ jobs: SCCACHE_GHA_ENABLED: "true" run: bash build-aux/appimage/build-container.sh - # The AppImage catalog tests on the oldest Ubuntu LTS in standard - # support. Loading the app there proves its glibc needs are old enough. - - name: Start AppImage on Ubuntu 22.04 - run: | - docker run --rm -v "$PWD/appimage-build:/appimage:ro" ubuntu:22.04 \ - sh -euc '/appimage/AdventureMods-*.AppImage --appimage-extract-and-run --version' + # The AppImage catalog opens the app on the oldest Ubuntu LTS in + # standard support, with only a virtual X server. The window there + # proves that its glibc needs are old enough and that it brings the + # libraries it opens at runtime. + - name: Open AppImage window on Ubuntu 22.04 + run: bash build-aux/appimage/test-window.sh appimage-build/AdventureMods-*.AppImage - name: Upload artifact uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 diff --git a/Cargo.lock b/Cargo.lock index 22e8675..410a6fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -134,7 +134,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "adventure-mods" -version = "1.3.5" +version = "1.3.6" dependencies = [ "anyhow", "async-channel", diff --git a/Cargo.toml b/Cargo.toml index af78e46..345fede 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "adventure-mods" -version = "1.3.5" +version = "1.3.6" edition = "2024" license = "MIT" diff --git a/build-aux/appimage/build-appimage.sh b/build-aux/appimage/build-appimage.sh index 4478ccd..94b2e43 100755 --- a/build-aux/appimage/build-appimage.sh +++ b/build-aux/appimage/build-appimage.sh @@ -56,14 +56,28 @@ HOOK echo "==> Bundling libraries and creating the AppImage" cd "$BUILD_DIR" -# OpenGL, Vulkan, Wayland and xkbcommon are loaded at runtime from the host, -# so they match its graphics drivers and are not bundled. +# winit opens the X11 and Wayland libraries at runtime, so linuxdeploy can't +# see them. OpenGL, EGL, libX11, libxcb and libwayland-client come from the +# host: they are on the AppImage exclude list, because they must match its +# graphics drivers and display server. These are not on it, and minimal +# systems don't have them, so the AppImage brings them. linuxdeploy adds +# what they need in turn, such as libxcb-xkb and libXrender. +runtime_libs=() +for lib in libxkbcommon.so.0 libxkbcommon-x11.so.0 libXcursor.so.1 libXi.so.6; do + path="$(/sbin/ldconfig -p | awk -v lib="$lib" '$1 == lib { print $NF; exit }')" + if [ -z "$path" ]; then + echo "Missing $lib on the build system. Install it in build-container.sh." >&2 + exit 1 + fi + runtime_libs+=(--library "$path") +done export NO_STRIP=1 export LDAI_UPDATE_INFORMATION="gh-releases-zsync|astrovm|AdventureMods|latest|AdventureMods-v*-${APPIMAGE_ARCH}.AppImage.zsync" ./linuxdeploy --appimage-extract-and-run \ --appdir "$APPDIR" \ --desktop-file "$APPDIR/usr/share/applications/io.github.astrovm.AdventureMods.desktop" \ --icon-file "$APPDIR/usr/share/icons/hicolor/scalable/apps/io.github.astrovm.AdventureMods.svg" \ + "${runtime_libs[@]}" \ --output appimage # An AppImage uses the host's glibc, so it only starts where that glibc is at diff --git a/build-aux/appimage/build-container.sh b/build-aux/appimage/build-container.sh index ba39b65..643be17 100755 --- a/build-aux/appimage/build-container.sh +++ b/build-aux/appimage/build-container.sh @@ -37,6 +37,7 @@ fi apt-get install -y -qq \ build-essential pkg-config ninja-build python3-pip gettext \ libudev-dev desktop-file-utils appstream \ + libxkbcommon-x11-0 libxcursor1 libxi6 \ wget unzip file libfuse2 curl git sudo zsync pip3 install --quiet --no-cache-dir -r build-aux/appimage/requirements.txt curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --quiet diff --git a/build-aux/appimage/test-window.sh b/build-aux/appimage/test-window.sh new file mode 100755 index 0000000..454e26a --- /dev/null +++ b/build-aux/appimage/test-window.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Start the AppImage on a minimal Ubuntu 22.04 with only a virtual X server, +# the way the AppImage catalog tests it, and check that its window opens. +# Usage: test-window.sh [platform, such as linux/arm64] +set -euo pipefail + +appimage="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" +platform="${2:-}" +engine="$(command -v podman || command -v docker)" +platform_args=() +if [ -n "$platform" ]; then + platform_args=(--platform "$platform") +fi + +"$engine" run --rm "${platform_args[@]}" \ + -e DEBIAN_FRONTEND=noninteractive \ + -v "$appimage:/app.AppImage:ro" \ + docker.io/library/ubuntu:22.04 \ + bash -c ' + set -euo pipefail + apt-get update -qq + # Xvfb brings libX11 and libxcb; Mesa brings OpenGL. Nothing else. + apt-get install -y -qq --no-install-recommends \ + xvfb x11-utils libgl1-mesa-dri libgl1 libegl1 >/dev/null + Xvfb :99 -screen 0 1280x800x24 >/dev/null 2>&1 & + export DISPLAY=:99 HOME=/tmp/home + mkdir -p "$HOME" + for _ in $(seq 30); do + xdpyinfo >/dev/null 2>&1 && break + sleep 0.5 + done + xdpyinfo >/dev/null + cd /tmp + /app.AppImage --appimage-extract-and-run >/tmp/app.log 2>&1 & + app=$! + for _ in $(seq 60); do + if xwininfo -root -tree | grep -q "\"Adventure Mods\""; then + echo "The window opened." + kill "$app" 2>/dev/null || true + exit 0 + fi + if ! kill -0 "$app" 2>/dev/null; then + break + fi + sleep 1 + done + echo "The window did not open within 60 seconds:" >&2 + cat /tmp/app.log >&2 + exit 1 + ' diff --git a/data/io.github.astrovm.AdventureMods.metainfo.xml.in b/data/io.github.astrovm.AdventureMods.metainfo.xml.in index 18732b0..e0d5f7b 100644 --- a/data/io.github.astrovm.AdventureMods.metainfo.xml.in +++ b/data/io.github.astrovm.AdventureMods.metainfo.xml.in @@ -55,6 +55,11 @@ #1a5fb4 + + +

The AppImage opens its window on systems without some X11 keyboard and cursor libraries, such as a minimal Ubuntu 22.04.

+
+

The AppImage now starts on older systems, such as Ubuntu 22.04.

diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 0c2a93b..819d88f 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -134,7 +134,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "adventure-mods" -version = "1.3.4" +version = "1.3.6" dependencies = [ "anyhow", "async-channel", From 4b0b6549707f9c01c0ef69f3aa9cd6321a1cdb68 Mon Sep 17 00:00:00 2001 From: astrovm <5521045+astrovm@users.noreply.github.com> Date: Sat, 21 Nov 2026 08:06:52 -0300 Subject: [PATCH 2/7] test(appimage): require a mapped window and a running app --- .github/workflows/ci.yml | 1 + build-aux/appimage/test-window.sh | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3eba807..8c9afad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -265,6 +265,7 @@ jobs: # proves that its glibc needs are old enough and that it brings the # libraries it opens at runtime. - name: Open AppImage window on Ubuntu 22.04 + timeout-minutes: 10 run: bash build-aux/appimage/test-window.sh appimage-build/AdventureMods-*.AppImage - name: Upload artifact diff --git a/build-aux/appimage/test-window.sh b/build-aux/appimage/test-window.sh index 454e26a..dbed0d6 100755 --- a/build-aux/appimage/test-window.sh +++ b/build-aux/appimage/test-window.sh @@ -4,6 +4,10 @@ # Usage: test-window.sh [platform, such as linux/arm64] set -euo pipefail +if [ ! -f "${1:-}" ]; then + echo "Usage: $0 [platform]. No AppImage at '${1:-}'." >&2 + exit 2 +fi appimage="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" platform="${2:-}" engine="$(command -v podman || command -v docker)" @@ -34,10 +38,19 @@ fi /app.AppImage --appimage-extract-and-run >/tmp/app.log 2>&1 & app=$! for _ in $(seq 60); do - if xwininfo -root -tree | grep -q "\"Adventure Mods\""; then - echo "The window opened." - kill "$app" 2>/dev/null || true - exit 0 + # The window is mapped, not only created. + state="$(xwininfo -name "Adventure Mods" 2>/dev/null || true)" + if grep -q "IsViewable" <<<"$state"; then + # The app must survive its first frames too. + sleep 3 + if kill -0 "$app" 2>/dev/null; then + echo "The window opened." + kill "$app" 2>/dev/null || true + exit 0 + fi + echo "The window opened, but the app then stopped:" >&2 + cat /tmp/app.log >&2 + exit 1 fi if ! kill -0 "$app" 2>/dev/null; then break From cd827ecbbd4be0f95e71363ae42eb8b3601f3e9c Mon Sep 17 00:00:00 2001 From: astrovm <5521045+astrovm@users.noreply.github.com> Date: Sat, 21 Nov 2026 08:33:23 -0300 Subject: [PATCH 3/7] ci(appimage): run the AppImage catalog's own test --- .github/workflows/ci.yml | 31 +++++++- build-aux/appimage/catalog-test.sh | 112 +++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 2 deletions(-) create mode 100755 build-aux/appimage/catalog-test.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c9afad..466e90e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -274,6 +274,33 @@ jobs: name: AdventureMods-AppImage-${{ matrix.arch }} path: appimage-build/*.AppImage* + # The AppImage catalog (appimage.github.io) runs its own test on every + # entry: lint, firejail, a screenshot and checks on it. This runs that test + # on its runner, so that a release does not fail there. + appimage-catalog: + needs: appimage + runs-on: ubuntu-22.04 + timeout-minutes: 20 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Download AppImage + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: AdventureMods-AppImage-x86_64 + path: appimage-build + + - name: Run the AppImage catalog test + run: bash build-aux/appimage/catalog-test.sh appimage-build/AdventureMods-*-x86_64.AppImage Adventure_Mods + + - name: Upload catalog test result + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: AdventureMods-AppImage-catalog-test + path: appimage-catalog-result + if-no-files-found: ignore + snap: needs: changes if: needs.changes.outputs.packaging == 'true' @@ -334,7 +361,7 @@ jobs: ci: name: CI / Required if: always() - needs: [changes, test, translations, coverage, flatpak, appimage, snap] + needs: [changes, test, translations, coverage, flatpak, appimage, appimage-catalog, snap] runs-on: ubuntu-26.04 steps: - name: Check job results @@ -391,7 +418,7 @@ jobs: release: if: startsWith(github.ref, 'refs/tags/') - needs: [test, coverage, appimage, snap, flatpak, create-release] + needs: [test, coverage, appimage, appimage-catalog, snap, flatpak, create-release] runs-on: ubuntu-26.04 permissions: contents: write diff --git a/build-aux/appimage/catalog-test.sh b/build-aux/appimage/catalog-test.sh new file mode 100755 index 0000000..988a63b --- /dev/null +++ b/build-aux/appimage/catalog-test.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash +# Run the AppImage catalog's own test on a local AppImage: code/worker.sh from +# AppImage/appimage.github.io, set up as its .github/workflows/test.yml does. +# It runs the app in firejail, which loop-mounts the AppImage as root, so it +# needs a real host with sudo, such as a GitHub ubuntu-22.04 runner (the +# catalog uses one). A rootless container is not enough; for a quick local +# check, use test-window.sh. +# +# Usage: catalog-test.sh +# It writes log.txt, findings.txt and the screenshot to $CATALOG_RESULT +# (default: appimage-catalog-result). It fails when the catalog test fails or +# when the catalog would not mark the screenshot as good. +set -euo pipefail + +# The catalog changes its test often. Update this commit on purpose. +CATALOG_COMMIT="ba37bcf481d0e8429b4a5ef67d095c279dac7aa2" + +if [ ! -f "${1:-}" ] || [ -z "${2:-}" ]; then + echo "Usage: $0 " >&2 + exit 2 +fi +appimage="$(readlink -f "$1")" +name="$2" +result="$(readlink -f "${CATALOG_RESULT:-appimage-catalog-result}")" +work="$(mktemp -d)" +serve="$work/serve" +catalog="$work/catalog" +rm -rf "$result" +mkdir -p "$result" "$serve" + +pids=() +cleanup() { + if [ "${#pids[@]}" -gt 0 ]; then + kill "${pids[@]}" 2>/dev/null || true + fi +} +trap cleanup EXIT + +git clone -q --filter=blob:none https://github.com/AppImage/appimage.github.io "$catalog" +git -C "$catalog" checkout -q "$CATALOG_COMMIT" +cd "$catalog" + +echo "==> Installing the catalog's test packages" +packages="$(sed -n 's/^ *packages: *//p' .github/workflows/test.yml)" +if [ -z "$packages" ]; then + echo "Found no package list in the catalog's test.yml" >&2 + exit 1 +fi +sudo apt-get update -qq +# shellcheck disable=SC2086 # The list is space-separated. +sudo apt-get install -y -qq --no-install-recommends $packages >/dev/null +bash code/fetch-deps.sh >/dev/null +cp -a deps/. . +# The catalog workflow goes on when this fails, too. +sudo bash code/prep-dummy-soundcard.sh >/dev/null 2>&1 || true + +# The catalog downloads the AppImage from the link in data/. Serve this +# one under its own file name, so that the name checks see the real name. +cp "$appimage" "$serve/" +python3 -m http.server 8765 --bind 127.0.0.1 --directory "$serve" >/dev/null 2>&1 & +pids+=($!) +for _ in $(seq 20); do + curl -fsI "http://127.0.0.1:8765/" >/dev/null 2>&1 && break + sleep 0.5 +done +echo "http://127.0.0.1:8765/$(basename "$appimage")" >"data/$name" + +mkdir -p "$HOME/.icewm" +cat >"$HOME/.icewm/preferences" <<'EOF' +ShowTaskBar = 0 +TaskBarAutoHide = 1 +TaskBarShowWorkspaces = 0 +TaskBarShowAllWindows = 0 +TaskBarShowClock = 0 +TaskBarShowMailboxStatus = 0 +TaskBarShowCPUStatus = 0 +TaskBarShowWindowListMenu = 0 +EOF +Xvfb :99 -screen 0 800x600x24 >/dev/null 2>&1 & +pids+=($!) +export DISPLAY=:99 IS_PULLREQUEST=true STRICT=true + +echo "==> Running the catalog test" +set +e +timeout --kill-after=30 600 bash -e code/worker.sh "$catalog/data/$name" >log.txt 2>&1 +status=$? +set -e +cp log.txt "$result/" +cp "database/$name/screenshot.png" "$result/" 2>/dev/null || true +cp failure-screens/*.png "$result/" 2>/dev/null || true +grep -hE '^(ERROR|WARNING|NOTE): ' log.txt | sort -u >"$result/findings.txt" || true +bash code/diagnose.sh log.txt >"$result/hints.md" 2>/dev/null || true + +echo "==> Findings" +cat "$result/findings.txt" +if [ "$status" -ne 0 ]; then + echo "The catalog test failed (exit $status). See $result/log.txt." >&2 + tail -n 40 log.txt >&2 + exit 1 +fi +# The catalog's screenshot-ok rule from its test.yml: a screenshot, and no +# remark about the window or the screenshot except a dark window. +if [ ! -f "$result/screenshot.png" ]; then + echo "The catalog test made no screenshot." >&2 + exit 1 +fi +if grep -E '^(WARNING|ERROR): The (window|screenshot)' "$result/findings.txt" | + grep -qv '^WARNING: The window is mostly dark'; then + echo "The catalog would not mark the screenshot as good." >&2 + exit 1 +fi +echo "The catalog test passed." From 3f0e75f023d8990559d0055d5aea556f49e133c7 Mon Sep 17 00:00:00 2001 From: astrovm <5521045+astrovm@users.noreply.github.com> Date: Sat, 21 Nov 2026 08:39:13 -0300 Subject: [PATCH 4/7] fix(appimage): use a PNG icon as the AppImage thumbnail --- build-aux/appimage/build-appimage.sh | 9 +++++++++ build-aux/appimage/build-container.sh | 2 +- build-aux/appimage/catalog-test.sh | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/build-aux/appimage/build-appimage.sh b/build-aux/appimage/build-appimage.sh index 94b2e43..3268437 100755 --- a/build-aux/appimage/build-appimage.sh +++ b/build-aux/appimage/build-appimage.sh @@ -54,6 +54,15 @@ cat >"$APPDIR/apprun-hooks/adventure-mods.sh" <<'HOOK' export PATH="$APPDIR/usr/bin:$PATH" HOOK +# File managers and the AppImage catalog show .DirIcon as the thumbnail, and +# the catalog wants a PNG. linuxdeploy links it to the SVG, unless it exists. +icon_name="io.github.astrovm.AdventureMods" +icon_png="usr/share/icons/hicolor/256x256/apps/$icon_name.png" +mkdir -p "$APPDIR/$(dirname "$icon_png")" +rsvg-convert -w 256 -h 256 -o "$APPDIR/$icon_png" \ + "$APPDIR/usr/share/icons/hicolor/scalable/apps/$icon_name.svg" +ln -sfn "$icon_png" "$APPDIR/.DirIcon" + echo "==> Bundling libraries and creating the AppImage" cd "$BUILD_DIR" # winit opens the X11 and Wayland libraries at runtime, so linuxdeploy can't diff --git a/build-aux/appimage/build-container.sh b/build-aux/appimage/build-container.sh index 643be17..6ca19d1 100755 --- a/build-aux/appimage/build-container.sh +++ b/build-aux/appimage/build-container.sh @@ -37,7 +37,7 @@ fi apt-get install -y -qq \ build-essential pkg-config ninja-build python3-pip gettext \ libudev-dev desktop-file-utils appstream \ - libxkbcommon-x11-0 libxcursor1 libxi6 \ + libxkbcommon-x11-0 libxcursor1 libxi6 librsvg2-bin \ wget unzip file libfuse2 curl git sudo zsync pip3 install --quiet --no-cache-dir -r build-aux/appimage/requirements.txt curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --quiet diff --git a/build-aux/appimage/catalog-test.sh b/build-aux/appimage/catalog-test.sh index 988a63b..af6da60 100755 --- a/build-aux/appimage/catalog-test.sh +++ b/build-aux/appimage/catalog-test.sh @@ -49,6 +49,9 @@ fi sudo apt-get update -qq # shellcheck disable=SC2086 # The list is space-separated. sudo apt-get install -y -qq --no-install-recommends $packages >/dev/null +# worker.sh converts the desktop file with dv (dupervisor), as the catalog +# workflow installs it. It skips asar, which only Electron apps need. +sudo gem install dupervisor -v 1.0.5 >/dev/null bash code/fetch-deps.sh >/dev/null cp -a deps/. . # The catalog workflow goes on when this fails, too. From b52a4b5ef8d72ab9a153a18d516c1638a7e21683 Mon Sep 17 00:00:00 2001 From: astrovm <5521045+astrovm@users.noreply.github.com> Date: Sat, 21 Nov 2026 08:42:38 -0300 Subject: [PATCH 5/7] ci(appimage): serve the AppImage to the catalog test with Node --- build-aux/appimage/catalog-test.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/build-aux/appimage/catalog-test.sh b/build-aux/appimage/catalog-test.sh index af6da60..0b65847 100755 --- a/build-aux/appimage/catalog-test.sh +++ b/build-aux/appimage/catalog-test.sh @@ -60,13 +60,27 @@ sudo bash code/prep-dummy-soundcard.sh >/dev/null 2>&1 || true # The catalog downloads the AppImage from the link in data/. Serve this # one under its own file name, so that the name checks see the real name. cp "$appimage" "$serve/" -python3 -m http.server 8765 --bind 127.0.0.1 --directory "$serve" >/dev/null 2>&1 & +# GitHub runners have Node.js. +node -e ' +const http = require("http"), fs = require("fs"), path = require("path"); +const dir = process.argv[1]; +http.createServer((request, response) => { + const file = path.join(dir, path.basename(decodeURIComponent(request.url.split("?")[0]))); + fs.stat(file, (error, stat) => { + if (error || !stat.isFile()) { response.writeHead(404); return response.end(); } + response.writeHead(200, { "Content-Length": stat.size }); + if (request.method === "HEAD") return response.end(); + fs.createReadStream(file).pipe(response); + }); +}).listen(8765, "127.0.0.1"); +' "$serve" & pids+=($!) +url="http://127.0.0.1:8765/$(basename "$appimage")" for _ in $(seq 20); do - curl -fsI "http://127.0.0.1:8765/" >/dev/null 2>&1 && break + curl -fsI "$url" >/dev/null 2>&1 && break sleep 0.5 done -echo "http://127.0.0.1:8765/$(basename "$appimage")" >"data/$name" +echo "$url" >"data/$name" mkdir -p "$HOME/.icewm" cat >"$HOME/.icewm/preferences" <<'EOF' From c465ac9e9a41fbfa794a9e23e667f18c15f888b5 Mon Sep 17 00:00:00 2001 From: astrovm <5521045+astrovm@users.noreply.github.com> Date: Sat, 21 Nov 2026 09:07:03 -0300 Subject: [PATCH 6/7] fix(ci): keep the catalog test result out of the release files --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 466e90e..baf151c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -297,7 +297,8 @@ jobs: if: always() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: AdventureMods-AppImage-catalog-test + # Outside the AdventureMods-AppImage-* pattern the release job downloads. + name: appimage-catalog-test path: appimage-catalog-result if-no-files-found: ignore From f7a8627e06ee11189ff6dbe4f2087ed728f764d8 Mon Sep 17 00:00:00 2001 From: astrovm <5521045+astrovm@users.noreply.github.com> Date: Sat, 21 Nov 2026 09:07:03 -0300 Subject: [PATCH 7/7] test(appimage): fail the catalog test on new warnings --- build-aux/appimage/catalog-test.sh | 35 ++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/build-aux/appimage/catalog-test.sh b/build-aux/appimage/catalog-test.sh index 0b65847..cb6808e 100755 --- a/build-aux/appimage/catalog-test.sh +++ b/build-aux/appimage/catalog-test.sh @@ -6,19 +6,35 @@ # catalog uses one). A rootless container is not enough; for a quick local # check, use test-window.sh. # +# It also changes the host as root, as the catalog's runner does: it installs +# packages and copies firejail into /lib, /usr and /etc. So it runs only on +# GitHub Actions, or with ALLOW_HOST_CHANGES=1 on a throwaway machine. +# # Usage: catalog-test.sh # It writes log.txt, findings.txt and the screenshot to $CATALOG_RESULT -# (default: appimage-catalog-result). It fails when the catalog test fails or -# when the catalog would not mark the screenshot as good. +# (default: appimage-catalog-result). It fails when the catalog test fails, +# makes no screenshot, or finds a warning or error that is not in $known. set -euo pipefail # The catalog changes its test often. Update this commit on purpose. CATALOG_COMMIT="ba37bcf481d0e8429b4a5ef67d095c279dac7aa2" +# The findings this app is known to have. Any other warning or error fails, +# so that a fixed warning, such as the icon format, cannot come back. +# - No appdata file present: the catalog looks only for *appdata.xml, and its +# old appstreamcli fails on the current file under that name. +# - The window is mostly dark: the app's blue design. The catalog ignores it +# for its screenshot-ok label. +known='^WARNING: (No appdata file present|The window is mostly dark)' + if [ ! -f "${1:-}" ] || [ -z "${2:-}" ]; then echo "Usage: $0 " >&2 exit 2 fi +if [ "${GITHUB_ACTIONS:-}" != true ] && [ "${ALLOW_HOST_CHANGES:-}" != 1 ]; then + echo "This test changes the host as root. Run it on GitHub Actions, or set ALLOW_HOST_CHANGES=1 on a throwaway machine." >&2 + exit 2 +fi appimage="$(readlink -f "$1")" name="$2" result="$(readlink -f "${CATALOG_RESULT:-appimage-catalog-result}")" @@ -33,6 +49,8 @@ cleanup() { if [ "${#pids[@]}" -gt 0 ]; then kill "${pids[@]}" 2>/dev/null || true fi + # worker.sh extracts firejail into the work folder as root. + sudo rm -rf "$work" } trap cleanup EXIT @@ -54,8 +72,8 @@ sudo apt-get install -y -qq --no-install-recommends $packages >/dev/null sudo gem install dupervisor -v 1.0.5 >/dev/null bash code/fetch-deps.sh >/dev/null cp -a deps/. . -# The catalog workflow goes on when this fails, too. -sudo bash code/prep-dummy-soundcard.sh >/dev/null 2>&1 || true +# The catalog workflow stops when this fails, so this test stops too. +sudo bash code/prep-dummy-soundcard.sh >/dev/null # The catalog downloads the AppImage from the link in data/. Serve this # one under its own file name, so that the name checks see the real name. @@ -115,15 +133,14 @@ if [ "$status" -ne 0 ]; then tail -n 40 log.txt >&2 exit 1 fi -# The catalog's screenshot-ok rule from its test.yml: a screenshot, and no -# remark about the window or the screenshot except a dark window. if [ ! -f "$result/screenshot.png" ]; then echo "The catalog test made no screenshot." >&2 exit 1 fi -if grep -E '^(WARNING|ERROR): The (window|screenshot)' "$result/findings.txt" | - grep -qv '^WARNING: The window is mostly dark'; then - echo "The catalog would not mark the screenshot as good." >&2 +unknown="$(grep -E '^(WARNING|ERROR): ' "$result/findings.txt" | grep -Ev "$known" || true)" +if [ -n "$unknown" ]; then + echo "The catalog test found new warnings or errors:" >&2 + echo "$unknown" >&2 exit 1 fi echo "The catalog test passed."