From 464b9ebc95ca0743dd13337a9db7159aab76292a Mon Sep 17 00:00:00 2001 From: DioEgizio <83089242+DioEgizio@users.noreply.github.com> Date: Mon, 14 Nov 2022 17:29:41 +0100 Subject: [PATCH] feat: add flatpak builds to the ci for testing Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com> --- .github/workflows/build.yml | 23 +++++- flatpak/org.prismlauncher.PrismLauncher.yml | 83 +++++++++++++++++++++ flatpak/prime-run | 4 + flatpak/prismlauncher | 11 +++ 4 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 flatpak/org.prismlauncher.PrismLauncher.yml create mode 100644 flatpak/prime-run create mode 100644 flatpak/prismlauncher diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61fd9b4c..df8aae39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -492,16 +492,35 @@ jobs: submodules: 'true' - name: Set short version shell: bash + if: inputs.build_type == 'Debug' run: | ver_short=`git rev-parse --short HEAD` echo "VERSION=$ver_short" >> $GITHUB_ENV - name: Package Snap (Linux) id: snapcraft - if: runner.os == 'Linux' && inputs.build_type == 'Debug' + if: inputs.build_type == 'Debug' uses: snapcore/action-build@v1 - name: Upload Snap (Linux) - if: runner.os == 'Linux' && inputs.build_type == 'Debug' + if: inputs.build_type == 'Debug' uses: actions/upload-artifact@v3 with: name: prismlauncher_${{ env.VERSION }}_amd64.snap path: ${{ steps.snapcraft.outputs.snap }} + + flatpak: + runs-on: ubuntu-latest + container: + image: bilelmoussaoui/flatpak-github-actions:kde-5.15-22.08 + options: --privileged + steps: + - name: Checkout + uses: actions/checkout@v3 + if: inputs.build_type == 'Debug' + with: + submodules: 'true' + - name: Build Flatpak (Linux) + if: inputs.build_type == 'Debug' + uses: flatpak/flatpak-github-actions/flatpak-builder@v4 + with: + bundle: "Prism Launcher.flatpak" + manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml diff --git a/flatpak/org.prismlauncher.PrismLauncher.yml b/flatpak/org.prismlauncher.PrismLauncher.yml new file mode 100644 index 00000000..fca306d7 --- /dev/null +++ b/flatpak/org.prismlauncher.PrismLauncher.yml @@ -0,0 +1,83 @@ +id: org.prismlauncher.PrismLauncher +runtime: org.kde.Platform +runtime-version: "5.15-22.08" +sdk: org.kde.Sdk +sdk-extensions: + - org.freedesktop.Sdk.Extension.openjdk17 + - org.freedesktop.Sdk.Extension.openjdk8 +add-extensions: + com.valvesoftware.Steam.Utility.gamescope: + version: stable + add-ld-path: lib + no-autodownload: true + autodelete: false + directory: utils/gamescope + +command: prismlauncher +finish-args: + - --share=ipc + - --socket=x11 + - --socket=wayland + - --device=all + - --share=network + - --socket=pulseaudio + # for Discord RPC mods + - --filesystem=xdg-run/app/com.discordapp.Discord:create + # Mod drag&drop + - --filesystem=xdg-download:ro + +modules: + - name: prismlauncher + buildsystem: cmake-ninja + config-opts: + - -DLauncher_BUILD_PLATFORM=flatpak + - -DCMAKE_BUILD_TYPE=Debug + build-options: + env: + JAVA_HOME: /usr/lib/sdk/openjdk17/jvm/openjdk-17 + JAVA_COMPILER: /usr/lib/sdk/openjdk17/jvm/openjdk-17/bin/javac + sources: + - type: dir + path: ../ + - name: openjdk + buildsystem: simple + build-commands: + - mkdir -p /app/jdk/ + - /usr/lib/sdk/openjdk17/install.sh + - mv /app/jre /app/jdk/17 + - /usr/lib/sdk/openjdk8/install.sh + - mv /app/jre /app/jdk/8 + cleanup: [/jre] + - name: xrandr + buildsystem: autotools + sources: + - type: archive + url: https://xorg.freedesktop.org/archive/individual/app/xrandr-1.5.1.tar.xz + sha256: 7bc76daf9d72f8aff885efad04ce06b90488a1a169d118dea8a2b661832e8762 + cleanup: [/share/man, /bin/xkeystone] + - name: gamemode + buildsystem: meson + config-opts: + - -Dwith-sd-bus-provider=no-daemon + - -Dwith-examples=false + post-install: + # gamemoderun is installed for users who want to use wrapper commands + # post-install is running inside the build dir, we need it from the source though + - install -Dm755 ../data/gamemoderun -t /app/bin + sources: + - type: git + url: https://github.com/FeralInteractive/gamemode + tag: "1.7" + commit: 4dc99dff76218718763a6b07fc1900fa6d1dafd9 + - name: enhance + buildsystem: simple + build-commands: + - mkdir -p /app/utils/gamescope + - install -Dm755 prime-run /app/bin/prime-run + - mv /app/bin/prismlauncher /app/bin/prismrun + - install -Dm755 prismlauncher /app/bin/prismlauncher + sources: + - type: file + path: ../flatpak/prime-run + - type: file + path: ../flatpak/prismlauncher diff --git a/flatpak/prime-run b/flatpak/prime-run new file mode 100644 index 00000000..946c28dd --- /dev/null +++ b/flatpak/prime-run @@ -0,0 +1,4 @@ +#!/bin/sh + +export __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia +exec "$@" diff --git a/flatpak/prismlauncher b/flatpak/prismlauncher new file mode 100644 index 00000000..bb876711 --- /dev/null +++ b/flatpak/prismlauncher @@ -0,0 +1,11 @@ +#!/bin/bash + +# discord RPC +for i in {0..9}; do + test -S "$XDG_RUNTIME_DIR"/discord-ipc-"$i" || ln -sf {app/com.discordapp.Discord,"$XDG_RUNTIME_DIR"}/discord-ipc-"$i"; +done + +export PATH="${PATH}${PATH:+:}/app/utils/gamescope/bin:/usr/lib/extensions/vulkan/MangoHud/bin" +export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}/usr/lib/extensions/vulkan/MangoHud/\$LIB/" + +exec /app/bin/prismrun "$@"