Skip to content

Add Linux Flatpak build to CI workflow#806

Open
sanderland wants to merge 10 commits intomasterfrom
claude/jolly-albattani
Open

Add Linux Flatpak build to CI workflow#806
sanderland wants to merge 10 commits intomasterfrom
claude/jolly-albattani

Conversation

@sanderland
Copy link
Copy Markdown
Owner

Summary

  • Add Flatpak packaging files (manifest, desktop entry, metainfo XML, icon) and a build-flatpak CI job that produces a .flatpak bundle artifact using the official flatpak/flatpak-github-actions action
  • Pull in dependabot bumps: urllib3 2.5.0 → 2.6.3, pillow 11.2.1 → 11.3.0

Test plan

  • CI build-flatpak job completes successfully
  • Flatpak bundle artifact is uploaded and downloadable
  • flatpak install --user KaTrain-*.flatpak && flatpak run org.katrain.KaTrain launches the app
  • KataGo engine starts inside the sandbox
  • SGF files can be loaded/saved

🤖 Generated with Claude Code

dependabot bot and others added 8 commits February 15, 2026 10:54
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.5.0 to 2.6.3.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@2.5.0...2.6.3)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.6.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [pillow](https://github.com/python-pillow/Pillow) from 11.2.1 to 11.3.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](python-pillow/Pillow@11.2.1...11.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 11.3.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Add Flatpak packaging files (manifest, desktop entry, metainfo, icon)
and a build-flatpak CI job that produces a .flatpak bundle artifact.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The hatchling build backend wasn't available in the Flatpak build
environment, causing pip to fail. Removing --no-build-isolation lets
pip fetch hatchling automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add mtdev module to provide libmtdev.so.1, fixing HIDInputMotionEventProvider crash
- Add libzip module (cmake) missing from freedesktop Platform 24.08 runtime
- Add katrain-wrapper script that sets KIVY_CLIPBOARD=sdl2 so clipboard
  works without xclip/xsel, which are unavailable in the flatpak sandbox

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
git source type requires credential prompting in the flatpak build
sandbox; archive sources work without authentication and are reproducible.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Downloads the prebuilt KataGo v1.16.0 eigenavx2 Linux x86_64 binary
(CPU-only, works on any modern CPU with AVX2) and installs it into the
katrain package's KataGo directory so the engine can find it at the
default Linux path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces eigenavx2 with the OpenCL build for GPU acceleration.
Also updates to the latest stable release (v1.16.4).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tquid
Copy link
Copy Markdown

tquid commented Mar 5, 2026

This should fix the build, however, the resulting flatpak silently segfaults on me on my local. I think it might be an X11/Wayland issue, but I'm still working on that bit. In any case if you can get the build passing, at least people with more flatpak experience might be able to help with debugging:

--- a/flatpak/org.katrain.KaTrain.yaml
+++ b/flatpak/org.katrain.KaTrain.yaml
@@ -21,8 +21,8 @@ modules:
       - --disable-static
     sources:
       - type: archive
-        url: https://gitlab.freedesktop.org/libevdev/mtdev/-/archive/v1.1.7/mtdev-v1.1.7.tar.gz
-        sha256: 50f6ed402789219e75ccfe72ab5aa52d21512e376406105566cc693fcd1114dc
+        url: https://bitmath.org/code/mtdev/mtdev-1.1.7.tar.bz2
+        sha256: a107adad2101fecac54ac7f9f0e0a0dd155d954193da55c2340c97f2ff1d814e
 
   - name: libzip
     buildsystem: cmake-ninja

sanderland and others added 2 commits March 5, 2026 21:28
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GitLab dynamic archive endpoints produce non-deterministic checksums.
Switch to the canonical release tarball which has a stable sha256.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- --disable-static
sources:
- type: archive
url: https://bitmath.org/code/mtdev/mtdev-1.1.7.tar.bz2
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tquid 🚀

@tquid
Copy link
Copy Markdown

tquid commented Mar 10, 2026

There is a more fundamental issue here. Since AppImages use FUSE filesystem access, they fail when you try to execute them inside a flatpak, because the flatpak sandbox doesn't allow that. The cure is to unspool the appimage with --appimage-extract, but we can't only do that with the build manifest. Since the user has options to grab katago appimages at runtime, there need to be hooks in there as well, that basically go "am I in a flatpak", and if so, do the appimage extract and set appropriate paths.

I don't know enough about flatpaks and appimage architecture, nor about KaTrain's code, to implement something like that. But it seems like the next obstacle here.

Edit: here's what that error looks like:

ERROR: Unexpected exception Expecting value: line 1 column 1 (char 0) while processing KataGo output b'Error: No suitable fusermount binary found on the $PATH'
This doesn't look like a squashfs image.
open dir error: No such file or directory
ERROR: Engine died unexpectedly without sending output:  status 127

@tquid
Copy link
Copy Markdown

tquid commented Mar 11, 2026

The appimage thing isn't too tough to fix, seems like, but I eventually hit a wall trying to get Kivy to deal with Wayland. Even with XWayland running to do pretend X11, I can't get the flatpak to even bring up a GUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants