OrcaStudio/.github/workflows/build_linux_appimage.yml
2026-07-26 09:37:23 +02:00

200 lines
6.9 KiB
YAML

name: Build Linux AppImage
on:
workflow_call:
workflow_dispatch:
concurrency:
group: build-linux-appimage-${{ github.ref }}
cancel-in-progress: true
env:
CACHE_REV: v1
jobs:
linux_appimage_ubuntu24:
name: Linux AppImage (ubuntu-24.04)
runs-on: ubuntu-24.04
timeout-minutes: 360
env:
DIST_ID: ubuntu24.04
EVENT_TAG: ${{ github.event.release.tag_name }}
ORCA_BUNDLE_DESKTOP_STACK: '0'
steps:
- name: Checkout
uses: actions/checkout@v6
with:
lfs: 'false'
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~4.3.0"
useLocalCache: true
useCloudCache: true
- name: Compute version
shell: bash
run: |
set -euo pipefail
tag="${EVENT_TAG:-${GITHUB_REF_NAME:-}}"
if [[ "$tag" == v* ]]; then
ver="${tag#v}"
else
ver="git${GITHUB_SHA::7}"
fi
echo "VER=$ver" >> "$GITHUB_ENV"
- name: Compute deps cache key
shell: bash
run: |
set -euo pipefail
deps_tree="$(git rev-parse HEAD:deps 2>/dev/null || echo no-deps)"
recipe_hash="$(find build_linux.sh scripts/linux.d -type f -print0 | sort -z | xargs -0 cat | sha256sum | cut -c1-12)"
echo "DEPS_CACHE_KEY=linux-${DIST_ID}-deps-${deps_tree}-${recipe_hash}-${CACHE_REV}" >> "$GITHUB_ENV"
- name: Apt-Install Dependencies
uses: ./.github/actions/apt-install-deps
- name: Install AppImage build and smoke-test inputs
shell: bash
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
dbus-x11 \
libjavascriptcoregtk-4.1-0 \
libwebkit2gtk-4.1-dev \
xvfb
pkg-config --exists webkit2gtk-4.1
ldconfig -p | grep -F 'libwebkit2gtk-4.1.so.0'
ldconfig -p | grep -F 'libjavascriptcoregtk-4.1.so.0'
- name: Linux - cache deps
id: cache_linux_deps
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep
key: ${{ env.DEPS_CACHE_KEY }}
- name: Linux - build deps if missing
if: steps.cache_linux_deps.outputs.cache-hit != 'true'
shell: bash
run: |
set -euo pipefail
for attempt in 1 2 3; do
echo "Build Linux deps attempt $attempt"
if ./build_linux.sh -drlL; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
echo "Transient dependency download/build failure, retrying after backoff"
sleep $((attempt * 20))
fi
done
exit 1
- name: Linux - build AppImage
shell: bash
run: |
set -euo pipefail
rm -rf build build-dbg build-dbginfo out
mkdir -p out
ORCA_SKIP_APPIMAGE_AUDIT=1 ./build_linux.sh -strlL
(
cd build
ORCA_BUNDLE_DESKTOP_STACK=0 bash ./src/build_linux_image.sh -i -R Release
)
app_bin=""
for candidate in \
./build/package/bin/orca-studio.bin \
./build/package/bin/bambu-studio.bin \
./build/package/bin/orca-slicer.bin; do
if [ -x "$candidate" ]; then
app_bin="$candidate"
break
fi
done
if [ -z "$app_bin" ]; then
echo "ERROR: packaged app binary not found"
find ./build/package -maxdepth 3 -type f | LC_ALL=C sort
exit 1
fi
./scripts/check_appimage_libs.sh ./build/package "$app_bin"
test ! -e ./build/package/share/orca-bundled-desktop-runtime
test -z "$(find ./build/package -type f \( -name 'libwebkit2gtk-*.so*' -o -name 'libjavascriptcoregtk-*.so*' \) -print -quit)"
grep -F 'missing host WebKitGTK 4.1 runtime libraries' ./build/package/libexec/orca-studio-env
grep -F 'locale charmap' ./build/package/orca-studio
mapfile -t appimages < <(find build -maxdepth 3 -type f -name '*.AppImage' ! -name 'appimagetool.AppImage' | LC_ALL=C sort)
if (( ${#appimages[@]} == 0 )); then
echo "ERROR: AppImage not produced"
find build -maxdepth 3 -type f | LC_ALL=C sort
exit 1
fi
if (( ${#appimages[@]} > 1 )); then
echo "INFO: multiple AppImage candidates found, using the first sorted entry"
printf '%s\n' "${appimages[@]}"
fi
appimage="${appimages[0]}"
mv "$appimage" "out/OrcaStudio_Linux_AppImage_${DIST_ID}_amd64_${VER}.AppImage"
final_appimage="out/OrcaStudio_Linux_AppImage_${DIST_ID}_amd64_${VER}.AppImage"
chmod +x "$final_appimage"
rm -rf out/squashfs-root
(
cd out
"./$(basename "$final_appimage")" --appimage-extract >/dev/null
)
./scripts/check_appimage_libs.sh out/squashfs-root out/squashfs-root/bin/orca-studio.bin
smoke_root="$(mktemp -d)"
mkdir -p "$smoke_root/home" "$smoke_root/config" "$smoke_root/cache" "$smoke_root/runtime"
chmod 0700 "$smoke_root/runtime"
smoke_log="$smoke_root/appimage-smoke.log"
set +e
timeout --signal=TERM --kill-after=5s 20s \
xvfb-run -a dbus-run-session -- \
env \
HOME="$smoke_root/home" \
XDG_CONFIG_HOME="$smoke_root/config" \
XDG_CACHE_HOME="$smoke_root/cache" \
XDG_RUNTIME_DIR="$smoke_root/runtime" \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
out/squashfs-root/AppRun >"$smoke_log" 2>&1
smoke_rc=$?
set -e
if [[ "$smoke_rc" -ne 0 && "$smoke_rc" -ne 124 && "$smoke_rc" -ne 143 ]]; then
echo "ERROR: AppImage startup smoke test exited unexpectedly: $smoke_rc" >&2
cat "$smoke_log" >&2
exit "$smoke_rc"
fi
if grep -Fq 'Unable to spawn a new child process' "$smoke_log" || \
grep -Fq 'Switching Orca Slicer to language' "$smoke_log" || \
grep -Fq 'dumped core' "$smoke_log"; then
echo "ERROR: AppImage startup smoke test found a fatal runtime diagnostic" >&2
cat "$smoke_log" >&2
exit 1
fi
echo "AppImage startup smoke test passed (process remained healthy until timeout)."
rm -rf "$smoke_root" out/squashfs-root
- name: Linux - checksums
shell: bash
run: |
set -euo pipefail
(cd out && sha256sum * > "SHA256SUMS_${DIST_ID}_appimage.txt")
- name: Upload artifacts (Linux AppImage ubuntu24.04)
uses: actions/upload-artifact@v7
with:
name: orcastudio-linux-appimage-${{ env.DIST_ID }}-${{ github.sha }}
path: out/
if-no-files-found: error