From e0a51e117d85ef6c4d9a6b857731eade2ce147d3 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 13 Sep 2025 15:59:21 +1000 Subject: [PATCH] CI/Flatpak: Replace with a wrapped AppImage One less thing to maintain, fewer things to go wrong. Especially since the number of users can apparently be counted on one hand. It's this or I remove it completely. --- .github/workflows/flathub-publish.yml | 9 +- .github/workflows/linux-flatpak-build.yml | 33 ++----- .github/workflows/main.yml | 1 + .../flatpak/org.duckstation.DuckStation.yaml | 96 +++---------------- 4 files changed, 30 insertions(+), 109 deletions(-) diff --git a/.github/workflows/flathub-publish.yml b/.github/workflows/flathub-publish.yml index 0a9d6b424..3abcef5b3 100644 --- a/.github/workflows/flathub-publish.yml +++ b/.github/workflows/flathub-publish.yml @@ -13,8 +13,15 @@ on: - "beta" jobs: + linux-appimage: + name: 🐧 Linux AppImage + uses: "./.github/workflows/linux-appimage-build.yml" + linux-cross-appimage: + name: 🐧 Linux Cross-Compiled AppImage + uses: "./.github/workflows/linux-cross-appimage-build.yml" linux-flatpak: - name: Build Flatpak + name: 📦 Build Flatpak + needs: [linux-appimage, linux-cross-appimage] uses: "./.github/workflows/linux-flatpak-build.yml" with: flathub_publish: true diff --git a/.github/workflows/linux-flatpak-build.yml b/.github/workflows/linux-flatpak-build.yml index f499d9aa1..a154cd98e 100644 --- a/.github/workflows/linux-flatpak-build.yml +++ b/.github/workflows/linux-flatpak-build.yml @@ -11,7 +11,6 @@ on: required: false type: string default: "stable" - workflow_dispatch: jobs: linux-flatpak-build: @@ -19,11 +18,11 @@ jobs: strategy: fail-fast: true matrix: - setup: [{arch: "x86_64", runner: "ubuntu-22.04"}, {arch: "aarch64", runner: "ubuntu-24.04-arm"}] + setup: [{arch: "x86_64", ainame: "x64", runner: "ubuntu-22.04"}, {arch: "aarch64", ainame: "arm64", runner: "ubuntu-24.04-arm"}] runs-on: ${{ matrix.setup.runner }} container: - image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.9 + image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-24.08 options: --privileged timeout-minutes: 60 steps: @@ -37,28 +36,16 @@ jobs: shell: bash run: git config --global --add safe.directory "*" - - name: Set Build Tags - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' - run: | - echo '#pragma once' > src/scmversion/tag.h - echo '#define SCM_RELEASE_TAGS {"latest", "preview"}' >> src/scmversion/tag.h - - - name: Tag as Preview Release - if: github.ref == 'refs/heads/master' - run: | - echo '#define SCM_RELEASE_TAG "preview"' >> src/scmversion/tag.h - - - name: Tag as Rolling Release - if: github.ref == 'refs/heads/dev' - run: | - echo '#define SCM_RELEASE_TAG "latest"' >> src/scmversion/tag.h + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + name: "linux-${{ matrix.setup.ainame }}-appimage" + path: ./artifacts/ - - name: Download Patch Archives + - name: Move AppImage shell: bash run: | - cd data/resources - curl -LO "https://github.com/duckstation/chtdb/releases/download/latest/cheats.zip" - curl -LO "https://github.com/duckstation/chtdb/releases/download/latest/patches.zip" + mv "./artifacts/DuckStation-${{ matrix.setup.ainame }}.AppImage" "scripts/packaging/flatpak/DuckStation.AppImage" - name: Generate AppStream XML run: | @@ -84,7 +71,7 @@ jobs: branch: stable cache: true restore-cache: true - cache-key: flatpak-${{ hashFiles('scripts/packaging/flatpak/org.duckstation.DuckStation.yaml', 'scripts/deps/build-dependencies-linux.sh') }} + cache-key: flatpak-${{ hashFiles('scripts/packaging/flatpak/org.duckstation.DuckStation.yaml') }} - name: Validate Build run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e61f13df6..6447ea5b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,6 +30,7 @@ jobs: uses: "./.github/workflows/linux-cross-appimage-build.yml" linux-flatpak: name: 📦 Linux Flatpak + needs: [linux-appimage, linux-cross-appimage] uses: "./.github/workflows/linux-flatpak-build.yml" macos: name: 🍎 MacOS diff --git a/scripts/packaging/flatpak/org.duckstation.DuckStation.yaml b/scripts/packaging/flatpak/org.duckstation.DuckStation.yaml index 232bcc340..0911e0d34 100644 --- a/scripts/packaging/flatpak/org.duckstation.DuckStation.yaml +++ b/scripts/packaging/flatpak/org.duckstation.DuckStation.yaml @@ -2,9 +2,9 @@ # SPDX-License-Identifier: CC-BY-NC-ND-4.0 app-id: "org.duckstation.DuckStation" -runtime: "org.kde.Platform" -runtime-version: "6.9" -sdk: "org.kde.Sdk" +runtime: "org.freedesktop.Platform" +runtime-version: "24.08" +sdk: "org.freedesktop.Sdk" sdk-extensions: - "org.freedesktop.Sdk.Extension.llvm19" @@ -21,91 +21,17 @@ finish-args: - "--socket=fallback-x11" modules: - # Dependencies. - - name: duckstation-deps + - name: duckstation buildsystem: simple sources: - type: file - path: ../../deps/build-dependencies-linux.sh - - type: file - path: ../../deps/versions - build-options: - # Don't need debug info for deps, match AppImage. - strip: true - no-debuginfo: true - - # Prevent flatpak defaults of fortify etc from creeping in. - cflags: "" - cflags-override: true - cxxflags: "" - cxxflags-override: true - - # Need network access to download sources. - build-args: - - "--share=network" - build-commands: - - "./build-dependencies-linux.sh -system-freetype -system-harfbuzz -system-libjpeg -system-libpng -system-libwebp -system-zlib -system-zstd -system-qt /app/deps" - cleanup: - - "*" - - # Main module. - - name: duckstation - buildsystem: cmake-ninja - builddir: true + path: DuckStation.AppImage build-options: - # Preserve debug information, it is needed for backtraces. + # Don't mess with binaries. strip: false no-debuginfo: true - - # Prevent flatpak defaults of fortify etc from creeping in. - cflags: "" - cflags-override: true - cxxflags: "" - cxxflags-override: true - - config-opts: - # Flatpak build does not appear to default to Release. - - "-DCMAKE_BUILD_TYPE=Release" - - # Dependencies path. - - "-DCMAKE_PREFIX_PATH=/app/deps" - - # Self-contained install, need to change the directory. - # Typical flatpak garbage makes it a pain to change the path from /app/bin... - - "-DCMAKE_INSTALL_PREFIX=/app/bin" - - "-DALLOW_INSTALL=ON" - - # We're not running tests as part of the flatpak build. - - "-DBUILD_TESTS=OFF" - - # Set the page range to 4K-16K. This has no effect on X86, but is required for - # ARM builds, as some devices are now shipping with 16K kernels. - - "-DHOST_MIN_PAGE_SIZE=4096" - - "-DHOST_MAX_PAGE_SIZE=16384" - - # Make sure we're using ThinLTO. - - "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" - - "-DCMAKE_C_COMPILER=/usr/lib/sdk/llvm19/bin/clang" - - "-DCMAKE_CXX_COMPILER=/usr/lib/sdk/llvm19/bin/clang++" - - "-DCMAKE_EXE_LINKER_FLAGS_INIT=-fuse-ld=lld" - - "-DCMAKE_MODULE_LINKER_FLAGS_INIT=-fuse-ld=lld" - - "-DCMAKE_SHARED_LINKER_FLAGS_INIT=-fuse-ld=lld" - sources: - - type: dir - path: ../../.. - - post-install: - # Manually copy desktop file/metadata, it's not done as part of the regular build. - - >- - install -Dm644 - "${FLATPAK_BUILDER_BUILDDIR}/scripts/packaging/org.duckstation.DuckStation.png" - "${FLATPAK_DEST}/share/icons/hicolor/512x512/apps/org.duckstation.DuckStation.png" - - >- - install -Dm644 - "${FLATPAK_BUILDER_BUILDDIR}/scripts/packaging/org.duckstation.DuckStation.desktop" - "${FLATPAK_DEST}/share/applications/org.duckstation.DuckStation.desktop" - - >- - install -Dm644 - "${FLATPAK_BUILDER_BUILDDIR}/scripts/packaging/flatpak/org.duckstation.DuckStation.metainfo.xml" - "${FLATPAK_DEST}/share/metainfo/org.duckstation.DuckStation.metainfo.xml" - + build-commands: + - "chmod +x DuckStation.AppImage" + - "./DuckStation.AppImage --appimage-extract" + - "mv squashfs-root/usr/* \"${FLATPAK_DEST}/\"" + - "rm -fr squashfs-root"