From f5eb933afd8b59e5b116bafc4dc091828f6005f1 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Mon, 19 Jan 2026 18:00:08 +0100 Subject: [PATCH 1/8] ci: Build the runtime against the SDK and test it This PR builds the runtime agains a new SDK, and tests it against several snaps. Specifically, it tests: * firefox * thunderbird * darktable * cheese * gimp * gnome-calculator * gnome-system-monitor * gnome-text-editor * evince * kicad * chromium * shotwell * telegram * mattermost It uses YARF OCR capabilities to detect that the application has been launched correctly. After it detects it, it waits five seconds and test again, to ensure that it is still working (thus to avoid the case where the window does appear but the application crashes immediately). If a test fails, it uploads an artifact with the YARF logs, to check if it's a test problem or a PR problem. --- .github/workflows/build.yml | 160 ++++++++++++++++++++++++++++++- .github/workflows/test_script.sh | 141 +++++++++++++++++++++++++++ 2 files changed, 298 insertions(+), 3 deletions(-) create mode 100755 .github/workflows/test_script.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91cc1d42..72cca986 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,14 +9,168 @@ on: jobs: snap: runs-on: ubuntu-latest + outputs: + runtime: ${{ steps.upload-runtime.outputs.artifact-id }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 + - name: Free disk space run: | sudo rm -rf /usr/local/lib/android - - uses: snapcore/action-build@v1 + + - name: Build SDK + uses: snapcore/action-build@v1 id: snapcraft - - uses: actions/upload-artifact@v4 + + - uses: actions/upload-artifact@v6 with: name: 'snap' path: ${{ steps.snapcraft.outputs.snap}} + + - name: Prepare runtime + run: | + set -eu + git clone --depth 1 --branch gnome-46-2404 https://github.com/ubuntu/gnome-sdk gnome-runtime + mkdir gnome-runtime/base-gnome-sdk + mv ${{ steps.snapcraft.outputs.snap}} gnome-runtime/base-gnome-sdk/ + cd gnome-runtime + ./local-build.py --prepare-only + + - name: Build runtime + uses: snapcore/action-build@v1 + id: snapcraft-runtime + with: + path: gnome-runtime + + - name: Delete old snap + run: | + rm -f gnome-runtime/base-gnome-sdk/*.snap + + - uses: actions/upload-artifact@v6 + id: upload-runtime + with: + name: 'snap-runtime' + path: ${{ steps.snapcraft-runtime.outputs.snap}} + + testing: + strategy: + fail-fast: false + matrix: + # define in 'snapname' the name of each snap to test + snapname: + - cheese + - chromium + - darktable + - evince + - firefox + - gimp + - gnome-calculator + - gnome-system-monitor + - gnome-text-editor + - kicad + - mattermost-desktop + - shotwell + - telegram-desktop + - thunderbird + # - epiphany + # here, in waittext, define the text to find for each snap + # more variables are: + # - commandname: the command to run instead of 'snap run $snapname' + # - timeout: the timeout to wait for the text to appear. Default is 20 seconds. + # - connections: an space-separated list of plugs that must be connected + # - enablex11: if true, will enable Xwayland + # - separated: if true, the words will be split and must be found each anywhere in the screen + include: + - snapname: "cheese" + waittext: "Take a Photo" + - snapname: "chromium" + waittext: "New Tab" + enablex11: "true" + - snapname: "darktable" + waittext: "darktable lighttable darkroom" + separated: "true" + - snapname: "evince" + waittext: "Document Viewer Open" + - snapname: "firefox" + waittext: "Welcome to Firefox" + - snapname: "gimp" + waittext: "Welcome to GIMP" + - snapname: "gnome-calculator" + waittext: "Basic mod" + separated: "true" + - snapname: "gnome-system-monitor" + waittext: "Network Resources Processes Disk Memory Swap CPU" + separated: "true" + - snapname: "gnome-text-editor" + waittext: "New Document" + - snapname: "kicad" + waittext: "Configure KiCad" + enablex11: "true" + - snapname: "mattermost-desktop" + waittext: "Mattermost Desktop" + commandname: "snap run mattermost-desktop" + enablex11: "true" + connections: "login-session-observe" + - snapname: "shotwell" + waittext: "Shotwell" + - snapname: "telegram-desktop" + waittext: "Welcome to the official Telegram Desktop app" + - snapname: "thunderbird" + waittext: "Thunderbird will automatically search" + # Current snapped version of epiphany fails to launch. Seems fixed in upstream. + # - snapname: "epiphany" + # waittext: "Set as Default Browser" + # enablex11: "true" + runs-on: ubuntu-latest + needs: snap + steps: + - name: Get data + uses: actions/checkout@v6 + - name: Download artifact + id: download-snap + uses: actions/download-artifact@v8 + with: + artifact-ids: ${{ needs.snap.outputs.runtime }} + - name: Install tools + run: | + set -eu + sudo snap refresh + sudo apt update + # dbus-x11 is required because it contains dbus-launch!! + # x11-apps are required to wait for XWayland + sudo apt install -y \ + dbus-daemon \ + dconf-gsettings-backend \ + xwayland \ + gnome-keyring \ + wayland-utils \ + xdg-desktop-portal-gnome \ + dbus-x11 \ + x11-apps \ + gnome-session-common \ + gnome-settings-daemon + # to be able to use Xwayland, --devmode is required + sudo snap install --devmode mir-test-tools + sudo snap install --beta yarf + sudo snap connect yarf:process-control + sudo snap install --dangerous ${{ steps.download-snap.outputs.download-path}}/*.snap + +# test application with the new runtime + - name: Test application + run: | + export TEST_SNAPNAME=${{ matrix.snapname }} + export TEST_WAITTEXT="${{ matrix.waittext }}" + export TEST_COMMAND_NAME="${{ matrix.commandname }}" + export TEST_DO_ENABLE_X11=${{ matrix.enablex11 }} + export TEST_DO_SEPARATED=${{ matrix.separated }} + export TEST_TIMEOUT=${{ matrix.timeout }} + export TEST_IFACE_CONNECTIONS=${{ matrix.connections }} + + ./.github/workflows/test_script.sh + + - uses: actions/upload-artifact@v6 + id: upload-yarf-log + if: always() + with: + path: ~/snap/yarf/common/yarf-outdir + name: yarf-failure-${{ matrix.snapname }} diff --git a/.github/workflows/test_script.sh b/.github/workflows/test_script.sh new file mode 100755 index 00000000..ec25ea50 --- /dev/null +++ b/.github/workflows/test_script.sh @@ -0,0 +1,141 @@ +#!/bin/bash + +set -eux -o pipefail + +export TEST_COMMAND_NAME="${TEST_COMMAND_NAME:-snap run ${TEST_SNAPNAME}}" +# default value for TEST_TIMEOUT: 20 seconds +export TEST_TIMEOUT=${TEST_TIMEOUT:-20} + +echo Testing ${TEST_SNAPNAME} with $TEST_COMMAND_NAME and waiting for ${TEST_WAITTEXT} +rm -rf ./testRobot +mkdir ./testRobot + +TEST_ROBOT_FILE=./testRobot/app.robot +cat > $TEST_ROBOT_FILE <> ${TEST_ROBOT_FILE} + export TEST_TIMEOUT="" + done + echo " Sleep 5" >> ${TEST_ROBOT_FILE} + for entry in ${TEST_WAITTEXT}; do + echo " Match Text ${entry}" >> ${TEST_ROBOT_FILE} + done +else + cat >> $TEST_ROBOT_FILE <> $TEST_ROBOT_FILE < /dev/null || (( ${counter} > 30 )); do + echo waiting for mir server... + sleep 1 + counter=$((counter+1)) +done + +if [[ "${TEST_DO_ENABLE_X11}" == "true" ]]; then + counter=0 + set +e + until (( ${counter} > 30 )); do + timeout 2 xclock + # 124 is "timeout" + if (( "$?" == "124" )); then + # end loop if timed out + echo XWayland available + counter=50 + else + echo Waiting for XWayland to be available + sleep 1 + fi + done + set -e + unset WAYLAND_DISPLAY + export XDG_SESSION_TYPE=x11 +fi + +echo Launching ${TEST_COMMAND_NAME} +${TEST_COMMAND_NAME} & command_pid=$! + +echo Launching YARF +YARF_RETERR=0 +APP_RETERR=0 +MIR_RETERR=0 +yarf --platform Mir ./testRobot || YARF_RETERR=$? + +echo Journal +journalctl --user --no-pager + +echo Waiting for application to die +# wait up to 10 seconds for the snap to finish. +timeout 10 tail --pid=${command_pid} -f /dev/null || /bin/true + +echo killing MIR server +# kill DBus and MIR and wait for it to fully finish. +kill $MIR_PID +wait $MIR_PID + +echo Cleaning up +# remove user data, just in case +rm -rf ~/snap/${TEST_SNAPNAME} +sudo snap remove ${TEST_SNAPNAME} || echo Failed to remove the snap +rm -rf ./testRobot +# only fail after cleanup +if [[ "$YARF_RETERR" != "0" ]]; then + /bin/false +fi From 57790a5b7797b5608365b226b5eb0a9bcfb2a662 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Wed, 15 Apr 2026 11:44:53 +0200 Subject: [PATCH 2/8] Use exit --- .github/workflows/test_script.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test_script.sh b/.github/workflows/test_script.sh index ec25ea50..8541cc9f 100755 --- a/.github/workflows/test_script.sh +++ b/.github/workflows/test_script.sh @@ -136,6 +136,4 @@ rm -rf ~/snap/${TEST_SNAPNAME} sudo snap remove ${TEST_SNAPNAME} || echo Failed to remove the snap rm -rf ./testRobot # only fail after cleanup -if [[ "$YARF_RETERR" != "0" ]]; then - /bin/false -fi +exit ${YARF_RETERR} From 905873114c93a984cbdc4bc294878e1a93440eb1 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Tue, 21 Apr 2026 13:19:30 +0200 Subject: [PATCH 3/8] Do all connections before showing them --- .github/workflows/test_script.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_script.sh b/.github/workflows/test_script.sh index 8541cc9f..cc5b8514 100755 --- a/.github/workflows/test_script.sh +++ b/.github/workflows/test_script.sh @@ -43,6 +43,8 @@ EOF echo "Test robot file:" cat ${TEST_ROBOT_FILE} sudo snap install ${TEST_SNAPNAME} || echo Snap already installed +# This is needed because the gnome runtime has been installed manually with --dangerous +sudo snap connect ${TEST_SNAPNAME}:gnome-46-2404 gnome-46-2404:gnome-46-2404 for plug in ${TEST_IFACE_CONNECTIONS}; do sudo snap connect ${TEST_SNAPNAME}:${plug} done @@ -69,9 +71,6 @@ export GNOME_SETUP_DISPLAY=:1 # use only GTK portal, since mutter isn't running sudo sed -i -e 's/gnome;gtk;/gtk;/g' /usr/share/xdg-desktop-portal/gnome-portals.conf -# This is needed because the gnome runtime has been installed manually with --dangerous -sudo snap connect ${TEST_SNAPNAME}:gnome-46-2404 gnome-46-2404:gnome-46-2404 - # this must be defined after launching the demo server; if not, it won't launch unset DISPLAY export ENABLE_X11_PROP="" From 994941ed9c2f78d9c2bbea50ccd040bda63be337 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Tue, 21 Apr 2026 14:39:07 +0200 Subject: [PATCH 4/8] New test for mattermost --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 72cca986..6ddd6a72 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,7 +107,8 @@ jobs: waittext: "Configure KiCad" enablex11: "true" - snapname: "mattermost-desktop" - waittext: "Mattermost Desktop" + waittext: "Mattermost Welcome" + separated: "true" commandname: "snap run mattermost-desktop" enablex11: "true" connections: "login-session-observe" From b6e024c88aae51376b94edd1b5df456d1f3708c3 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Tue, 21 Apr 2026 16:57:29 +0200 Subject: [PATCH 5/8] Fix mattermost --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6ddd6a72..bd6156b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,7 +107,7 @@ jobs: waittext: "Configure KiCad" enablex11: "true" - snapname: "mattermost-desktop" - waittext: "Mattermost Welcome" + waittext: "Mattermost" separated: "true" commandname: "snap run mattermost-desktop" enablex11: "true" From f8dd61aa28fae378fe71518e1bd53d9e41222832 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Fri, 24 Apr 2026 14:52:37 +0200 Subject: [PATCH 6/8] Workaround for mounting problems --- .github/workflows/test_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_script.sh b/.github/workflows/test_script.sh index cc5b8514..4cf266eb 100755 --- a/.github/workflows/test_script.sh +++ b/.github/workflows/test_script.sh @@ -48,6 +48,7 @@ sudo snap connect ${TEST_SNAPNAME}:gnome-46-2404 gnome-46-2404:gnome-46-2404 for plug in ${TEST_IFACE_CONNECTIONS}; do sudo snap connect ${TEST_SNAPNAME}:${plug} done +/usr/lib/snapd/snap-discard-ns ${TEST_SNAPNAME} echo Current connections: snap connections ${TEST_SNAPNAME} echo From ca78b592cc38748cb5bba6405f81289ec32861ae Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Fri, 24 Apr 2026 16:12:20 +0200 Subject: [PATCH 7/8] snap-discard must be run as root --- .github/workflows/test_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_script.sh b/.github/workflows/test_script.sh index 4cf266eb..18223997 100755 --- a/.github/workflows/test_script.sh +++ b/.github/workflows/test_script.sh @@ -48,7 +48,7 @@ sudo snap connect ${TEST_SNAPNAME}:gnome-46-2404 gnome-46-2404:gnome-46-2404 for plug in ${TEST_IFACE_CONNECTIONS}; do sudo snap connect ${TEST_SNAPNAME}:${plug} done -/usr/lib/snapd/snap-discard-ns ${TEST_SNAPNAME} +sudo /usr/lib/snapd/snap-discard-ns ${TEST_SNAPNAME} echo Current connections: snap connections ${TEST_SNAPNAME} echo From 9e6b8bb66d5c63da49f6be0200a2a58ff233767e Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Fri, 24 Apr 2026 16:20:25 +0200 Subject: [PATCH 8/8] Don't disable checks --- .github/workflows/test_script.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_script.sh b/.github/workflows/test_script.sh index 18223997..7cf628fa 100755 --- a/.github/workflows/test_script.sh +++ b/.github/workflows/test_script.sh @@ -91,11 +91,10 @@ done if [[ "${TEST_DO_ENABLE_X11}" == "true" ]]; then counter=0 - set +e until (( ${counter} > 30 )); do - timeout 2 xclock + timeout 2 xclock || EXIT_CODE=$? # 124 is "timeout" - if (( "$?" == "124" )); then + if (( "EXIT_CODE" == "124" )); then # end loop if timed out echo XWayland available counter=50 @@ -104,7 +103,6 @@ if [[ "${TEST_DO_ENABLE_X11}" == "true" ]]; then sleep 1 fi done - set -e unset WAYLAND_DISPLAY export XDG_SESSION_TYPE=x11 fi