Update AppImage deps and fix packaging

This commit is contained in:
deepend committed 2026-10-28 01:56:31 -06:00
1 parent 6e5ed9270e
commit 1c0c5e163b
10 files changed
+459 -141

No files matched your search

+62 -140
View File
@@ -1,6 +1,9 @@
name: AppImage Build
on:
workflow_dispatch:
schedule:
- cron: '23 6 * * 1'
push:
branches: [master, 'release/**']
pull_request:
@@ -29,16 +32,29 @@ jobs:
build-essential pkg-config meson ninja-build cmake \
gettext \
libcanberra-dev libglib2.0-dev \
libarchive-dev \
libarchive-dev libsecret-1-dev \
libgtk-3-dev libfontconfig1-dev libpango1.0-dev xvfb xauth dbus-daemon at-spi2-core \
libwayland-client0 libwayland-cursor0 libwayland-egl1 \
libxkbcommon0 \
libgtk-3-bin libglib2.0-bin glib-networking shared-mime-info gsettings-desktop-schemas \
liblua5.4-dev libpci-dev libperl-dev libssl-dev libayatana-appindicator3-dev \
perl python3 python3-minimal python3-dev python3-cffi python3-sphinx mono-devel desktop-file-utils \
perl python3 python3-sphinx mono-devel desktop-file-utils \
libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses-dev \
libreadline-dev libsqlite3-dev libzstd-dev tk-dev uuid-dev zlib1g-dev \
openssl ca-certificates \
breeze-gtk-theme \
patchelf file curl
- name: Build private Python runtime
run: |
set -eux
python_prefix="$RUNNER_TEMP/zoitechat-python"
bash packaging/appimage/build-python.sh "$python_prefix"
echo "$python_prefix/bin" >> "$GITHUB_PATH"
echo "ZOITECHAT_PYTHON_PREFIX=$python_prefix" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$python_prefix/lib" >> "$GITHUB_ENV"
echo "PKG_CONFIG_PATH=$python_prefix/lib/pkgconfig" >> "$GITHUB_ENV"
- name: Configure
run: |
set -eux
@@ -46,6 +62,7 @@ jobs:
meson setup build \
--prefix=/usr \
-Dinstall-docs=true \
-Ddocs-python=/usr/bin/python3 \
-Dtext-frontend=true \
-Dwith-perl=perl \
-Dwith-python=python3 \
@@ -70,25 +87,8 @@ jobs:
run: |
set -eux
python3_version="$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')"
install -Dm755 "$(command -v python3)" "AppDir/usr/bin/python3"
if [ -x "/usr/bin/perl" ]; then
install -Dm755 /usr/bin/perl AppDir/usr/bin/perl
fi
install -d AppDir/usr/lib
cp -a "/usr/lib/python${python3_version}" "AppDir/usr/lib/"
if [ -d "/usr/lib/python3/dist-packages" ]; then
install -d AppDir/usr/lib/python3
cp -a /usr/lib/python3/dist-packages AppDir/usr/lib/python3/
fi
if [ -d "/usr/lib/x86_64-linux-gnu/python3/dist-packages" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu/python3
cp -a /usr/lib/x86_64-linux-gnu/python3/dist-packages AppDir/usr/lib/x86_64-linux-gnu/python3/
fi
"$ZOITECHAT_PYTHON_PREFIX/bin/python3" packaging/appimage/bundle-python.py AppDir
install -Dm755 /usr/bin/perl AppDir/usr/bin/perl
if [ -d "/usr/lib/x86_64-linux-gnu/perl-base" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu
@@ -118,11 +118,6 @@ jobs:
perl -MFile::Spec -e 'print "Build host File::Spec: $INC{\"File/Spec.pm\"}\n"'
find AppDir/usr -path '*/File/Spec.pm' -print -quit | grep -q .
if compgen -G '/usr/lib/x86_64-linux-gnu/libpython3*.so*' > /dev/null; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/libpython3*.so* AppDir/usr/lib/x86_64-linux-gnu/
fi
# Every package ships the pinned font, including portable builds.
cmp data/fonts/NotoColorEmoji.ttf AppDir/usr/share/fonts/zoitechat/NotoColorEmoji.ttf
@@ -174,126 +169,20 @@ jobs:
chmod +x linuxdeploy-x86_64.AppImage
curl -fL --retry 3 -o linuxdeploy-plugin-gtk \
https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/7a3fbc31a9e5075073ff8790f26effbac5f84453/linuxdeploy-plugin-gtk.sh
# The generated GTK hook otherwise overrides both Wayland selection
# and the user's explicit GDK_BACKEND before our AppRun is reached.
grep -Fx 'export GDK_BACKEND=x11 # Crash with Wayland backend on Wayland' linuxdeploy-plugin-gtk
sed -i '/^export GDK_BACKEND=x11 # Crash with Wayland backend on Wayland$/d' linuxdeploy-plugin-gtk
chmod +x linuxdeploy-plugin-gtk
export PATH="${PWD}:${PATH}"
install -Dm644 /etc/ssl/certs/ca-certificates.crt \
AppDir/etc/ssl/certs/ca-certificates.crt
cat > AppRun <<'EOF'
#!/bin/sh
set -eu
install -m755 packaging/appimage/AppRun AppRun
APPDIR="${APPDIR:-$(dirname "$(readlink -f "$0")")}"
export PATH="$APPDIR/usr/bin:${PATH:-/usr/bin:/bin}"
export LD_LIBRARY_PATH="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:-}"
export XDG_DATA_DIRS="$APPDIR/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
export GTK_EXE_PREFIX="$APPDIR/usr"
export GTK_DATA_PREFIX="$APPDIR/usr"
gtk_path_entries=""
if [ -d "$APPDIR/usr/lib/x86_64-linux-gnu/gtk-3.0" ]; then
gtk_path_entries="$APPDIR/usr/lib/x86_64-linux-gnu/gtk-3.0"
fi
if [ -d "$APPDIR/usr/lib/gtk-3.0" ]; then
gtk_path_entries="${gtk_path_entries:+$gtk_path_entries:}$APPDIR/usr/lib/gtk-3.0"
fi
if [ -n "$gtk_path_entries" ]; then
export GTK_PATH="$gtk_path_entries${GTK_PATH:+:$GTK_PATH}"
fi
if [ -d "$APPDIR/usr/lib/x86_64-linux-gnu/zoitechat/plugins" ]; then
export ZOITECHAT_LIBDIR="$APPDIR/usr/lib/x86_64-linux-gnu/zoitechat/plugins"
elif [ -d "$APPDIR/usr/lib/zoitechat/plugins" ]; then
export ZOITECHAT_LIBDIR="$APPDIR/usr/lib/zoitechat/plugins"
fi
if [ -d "$APPDIR/usr/share/glib-2.0/schemas" ]; then
export GSETTINGS_SCHEMA_DIR="$APPDIR/usr/share/glib-2.0/schemas${GSETTINGS_SCHEMA_DIR:+:$GSETTINGS_SCHEMA_DIR}"
fi
if [ -d "$APPDIR/usr/lib/x86_64-linux-gnu/gio/modules" ]; then
gio_module_dir="$APPDIR/usr/lib/x86_64-linux-gnu/gio/modules"
elif [ -d "$APPDIR/usr/lib/gio/modules" ]; then
gio_module_dir="$APPDIR/usr/lib/gio/modules"
else
gio_module_dir=""
fi
if [ -n "$gio_module_dir" ]; then
export GIO_MODULE_DIR="$gio_module_dir"
export GIO_EXTRA_MODULES="$gio_module_dir"
fi
unset GTK_MODULES
perl5lib_entries=""
for dir in \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl-base" \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl"/* \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl5"/* \
"$APPDIR/usr/share/perl"/* \
"$APPDIR/usr/share/perl5"
do
if [ -d "$dir" ]; then
perl5lib_entries="${perl5lib_entries:+$perl5lib_entries:}$dir"
fi
done
if [ -n "$perl5lib_entries" ]; then
export PERL5LIB="$perl5lib_entries${PERL5LIB:+:$PERL5LIB}"
fi
export PYTHONHOME="$APPDIR/usr"
python_stdlib_dir="$(find "$APPDIR/usr/lib" -maxdepth 1 -type d -name 'python3.*' | head -n 1 || true)"
pythonpath_entries=""
if [ -n "$python_stdlib_dir" ] && [ -d "$python_stdlib_dir/dist-packages" ]; then
pythonpath_entries="$python_stdlib_dir/dist-packages"
fi
if [ -d "$APPDIR/usr/lib/python3/dist-packages" ]; then
pythonpath_entries="${pythonpath_entries:+$pythonpath_entries:}$APPDIR/usr/lib/python3/dist-packages"
fi
if [ -d "$APPDIR/usr/lib/x86_64-linux-gnu/python3/dist-packages" ]; then
pythonpath_entries="${pythonpath_entries:+$pythonpath_entries:}$APPDIR/usr/lib/x86_64-linux-gnu/python3/dist-packages"
fi
if [ -n "$pythonpath_entries" ]; then
export PYTHONPATH="$pythonpath_entries${PYTHONPATH:+:$PYTHONPATH}"
fi
# Register the private font without hiding the host's normal fonts.
export ZOITECHAT_EMOJI_FONT="${ZOITECHAT_EMOJI_FONT:-$APPDIR/usr/share/fonts/zoitechat/NotoColorEmoji.ttf}"
# OpenSSL trust store override
export SSL_CERT_FILE="${SSL_CERT_FILE:-$APPDIR/etc/ssl/certs/ca-certificates.crt}"
export SSL_CERT_DIR="${SSL_CERT_DIR:-$APPDIR/etc/ssl/certs}"
export CURL_CA_BUNDLE="${CURL_CA_BUNDLE:-$SSL_CERT_FILE}"
# Prefer Wayland if the session provides it, but keep X11 fallback.
# Don't override if the user already set GDK_BACKEND explicitly.
if [ -z "${GDK_BACKEND:-}" ]; then
if [ -n "${WAYLAND_DISPLAY:-}" ] || [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then
export GDK_BACKEND="wayland,x11"
else
export GDK_BACKEND="x11"
fi
fi
for hook_dir in "$APPDIR/apprun-hooks" "$APPDIR/usr/apprun-hooks"; do
if [ -d "$hook_dir" ]; then
for hook in "$hook_dir"/*.sh; do
if [ -f "$hook" ]; then
. "$hook"
fi
done
fi
done
exec "$APPDIR/usr/bin/zoitechat" "$@"
EOF
chmod +x AppRun
VERSION="$(git describe --tags --always)"
export VERSION="$(cat VERSION)"
./linuxdeploy-x86_64.AppImage \
--appdir AppDir \
@@ -304,7 +193,39 @@ jobs:
--output appimage
appimage_path="$(ls -1 *.AppImage | grep -v linuxdeploy | head -n 1)"
mv "$appimage_path" "Zoitechat-${VERSION}-x86_64.AppImage"
output_name="Zoitechat-${VERSION}-x86_64.AppImage"
if [ "$appimage_path" != "$output_name" ]; then
mv -- "$appimage_path" "$output_name"
fi
- name: Test packaged runtime and plugins
run: |
set -eux
appimage_path="$(find . -maxdepth 1 -name 'Zoitechat-*-x86_64.AppImage' -print -quit)"
test -n "$appimage_path"
mkdir -p "$RUNNER_TEMP/appimage check"
(cd "$RUNNER_TEMP/appimage check" && "$GITHUB_WORKSPACE/$appimage_path" --appimage-extract)
# Hide the build interpreter so it cannot mask broken relocation.
mv "$ZOITECHAT_PYTHON_PREFIX" "$ZOITECHAT_PYTHON_PREFIX.hidden"
trap 'mv "$ZOITECHAT_PYTHON_PREFIX.hidden" "$ZOITECHAT_PYTHON_PREFIX"' EXIT
env -u LD_LIBRARY_PATH -u PYTHONHOME -u PYTHONPATH \
/usr/bin/python3 packaging/appimage/check-runtime.py "$RUNNER_TEMP/appimage check/squashfs-root"
- name: Record dependency versions and checksum
run: |
set -eux
mkdir -p appimage-audit
dpkg-query -W -f='${binary:Package}\t${Version}\n' > appimage-audit/build-packages.tsv
cp "$RUNNER_TEMP/appimage check/runtime.json" appimage-audit/runtime.json
sha256sum linuxdeploy-x86_64.AppImage linuxdeploy-plugin-gtk > appimage-audit/build-tools.sha256
sha256sum Zoitechat-*-x86_64.AppImage > appimage-audit/SHA256SUMS
- name: Upload dependency audit
uses: actions/upload-artifact@v7
with:
name: zoitechat-appimage-audit
path: appimage-audit/
if-no-files-found: error
- name: Attest AppImage (Build Provenance)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
@@ -317,3 +238,4 @@ jobs:
with:
name: zoitechat-appimage
path: Zoitechat-*-x86_64.AppImage
if-no-files-found: error