From 9bb21e9272b41dd6827397336c878c1f3b4aa128 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Fri, 19 Jul 2024 16:07:50 +0900 Subject: [PATCH] Outsource ES-DE building to this repo --- .github/workflows/build_es-de.yml | 104 ++++++++++++++++++++++ automation_tools/install_dependencies.sh | 31 +++++++ automation_tools/update_es-de_manifest.sh | 22 +++++ es-de-module.yml | 91 +++++++++++++++++++ manifest-header.yml | 57 ++++++++++++ update_es-de_manifest.sh | 0 6 files changed, 305 insertions(+) create mode 100644 .github/workflows/build_es-de.yml create mode 100755 automation_tools/install_dependencies.sh create mode 100644 automation_tools/update_es-de_manifest.sh create mode 100644 es-de-module.yml create mode 100644 manifest-header.yml create mode 100644 update_es-de_manifest.sh diff --git a/.github/workflows/build_es-de.yml b/.github/workflows/build_es-de.yml new file mode 100644 index 000000000..ebfce1efb --- /dev/null +++ b/.github/workflows/build_es-de.yml @@ -0,0 +1,104 @@ +name: "Build ES-DE" + +on: + push: + branches: + - retrodeck-main + workflow_dispatch: + + +jobs: + + Building_RetroDECK-ES-DE: + runs-on: ubuntu-latest + steps: + + # Circumventing this bug: https://github.com/flatpak/flatpak-builder/issues/317 + # - name: Remove stuck mounts + # run: sudo umount -f /home/ubuntu/es-de-runner/_work/RetroDECK-ES-DE/RetroDECK-ES-DE/.flatpak-builder/rofiles/* + # continue-on-error: true + + - name: Clone repo + uses: actions/checkout@v3 + with: + submodules: 'true' + token: ${{ secrets.TRIGGER_BUILD_TOKEN }} + + - name: "Install dependencies" + run: "automation_tools/install_dependencies.sh" + + - name: "Creating ES-DE manifest" + run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/update_es-de_manifest.sh" + + - name: "[DEBUG] Outputting manifest" + run: cat net.retrodeck.es-de.yml + + - name: "Build flatpak" + id: "flatpak-download" + run: | + flatpak-builder --user --force-clean \ + --install-deps-from=flathub \ + --install-deps-from=flathub-beta \ + --repo=${GITHUB_WORKSPACE}/es-de-repo \ + "${GITHUB_WORKSPACE}"/es-de-build-dir \ + net.retrodeck.es-de.yml + + - name: "Exporting dir tree" + id: tree + run: tree -H ./ > ${GITHUB_WORKSPACE}/tree.html + + - name: Create Artifact for RetroDECK + run: | + tar -czf ${GITHUB_WORKSPACE}/RetroDECK-ES-DE-Artifact.tar.gz -C ${GITHUB_WORKSPACE}/es-de-build-dir . + hash=($(sha256sum ${GITHUB_WORKSPACE}/RetroDECK-ES-DE-Artifact.tar.gz)) + echo $hash > ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.sha + mv -f RetroDECK-Artifact-cooker.* ${{ secrets.ARTIFACT_REPO }} + continue-on-error: true + timeout-minutes: 1440 + + - name: Set environment variable with current branch name + run: echo "GITHUB_REF_SLUG=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV + + - name: Get branch name + id: branch_name + run: echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV + + - name: Get date + id: date + run: echo "DATE=$(date +'%d%m%y.%S')" >> $GITHUB_ENV + + - name: Publish the artifacts in a release + uses: ncipollo/release-action@v1 + with: + tag: "${{env.BRANCH_NAME}}-${{env.DATE}}" + body: | + # Release Notes + These are the artifact of RetroDECK ES-DE, commit: ${{ github.event.repository.full_name }}@${{github.sha}}. + On branch [${{env.BRANCH_NAME}}](https://github.com/XargonWan/RetroDECK-ES-DE/tree/${{env.BRANCH_NAME}}). + + artifacts: "RetroDECK-ES-DE-Artifact.tar.gz, tree.html" + allowUpdates: true + makeLatest: true + token: ${{ secrets.TRIGGER_BUILD_TOKEN }} + continue-on-error: true + + # - name: "Committing changes" + # with: + # github_token: ${{ secrets.TRIGGER_BUILD_TOKEN }} + # run: | + # git config user.name "GitHub Actions" + # git config user.email "actions@github.com" + # git add * net.retrodeck.es-de.yml + # git commit -m '[AUTOMATED] Updating ES-DE after build [skip ci]' + # git push origin main + # continue-on-error: true # TODO: would be good to update the manifest but it's broken + + - name: GitHub Commit & Push + uses: actions-js/push@v1.4 + with: + github_token: ${{ secrets.TRIGGER_BUILD_TOKEN }} + message: '[AUTOMATED] Updating ES-DE after build [skip ci]' + continue-on-error: true # TODO: would be good to update the manifest but it's broken + + + diff --git a/automation_tools/install_dependencies.sh b/automation_tools/install_dependencies.sh new file mode 100755 index 000000000..3daa4edb7 --- /dev/null +++ b/automation_tools/install_dependencies.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# This script is installing the required dependencies to correctly run the pipeline and build the flatpak + +unset pkg_mgr + +# rpm-ostree must be checked before dnf because a dnf (wrapper) command also works on rpm-ostree distros (not what we want) +for potential_pkg_mgr in apt pacman rpm-ostree dnf; do + command -v "$potential_pkg_mgr" &> /dev/null && pkg_mgr="$potential_pkg_mgr" && break +done + +case "$pkg_mgr" in + apt) + sudo apt install -y flatpak flatpak-builder p7zip-full xmlstarlet bzip2 curl jq + ;; + pacman) + sudo pacman -S --noconfirm flatpak flatpak-builder p7zip xmlstarlet bzip2 + ;; + rpm-ostree) + echo "When using a distro with rpm-ostree, you shouldn't build directly on the host. Try using a distrobox." + exit 1 + ;; + dnf) + sudo dnf install -y flatpak flatpak-builder p7zip p7zip-plugins xmlstarlet bzip2 curl + ;; + *) + echo "Package manager $pkg_mgr not supported. Please open an issue." + ;; +esac + +flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo +flatpak remote-add --user --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo diff --git a/automation_tools/update_es-de_manifest.sh b/automation_tools/update_es-de_manifest.sh new file mode 100644 index 000000000..f28f40981 --- /dev/null +++ b/automation_tools/update_es-de_manifest.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +git clone https://github.com/XargonWan/RetroDECK --depth=1 RetroDECK + +# Creating ES-DE manifest +manifest_header="manifest-header.yml" +esde_module="es-de-module.yml" +esde_manifest="net.retrodeck.es-de.yml" +command="/app/bin/es-de" + +# sed -n '/command/q;p' RetroDECK/net.retrodeck.retrodeck.yml > "$manifest_header" TEMPORARY DISABLED TO TRY A BUILD WITH ANOTHER RUNTIME +echo -e "command: $command\n" >> "$manifest_header" +sed -i '/^[[:space:]]*#/d' "$manifest_header" +sed -i 's/[[:space:]]*#.*$//' "$manifest_header" +sed -n '/finish-args:/,${/cleanup:/q;p;}' RetroDECK/net.retrodeck.retrodeck.yml >> "$manifest_header" + +sed -i 's/net.retrodeck.retrodeck/net.retrodeck.es-de/' "$manifest_header" + +cat "$manifest_header" > "$esde_manifest" +cat "$esde_module" >> "$esde_manifest" + +rm -rf RetroDECK \ No newline at end of file diff --git a/es-de-module.yml b/es-de-module.yml new file mode 100644 index 000000000..248c9174a --- /dev/null +++ b/es-de-module.yml @@ -0,0 +1,91 @@ + # ES-DE - START + # https://gitlab.com/es-de/emulationstation-de + + - name: ffmpeg + config-opts: + - --disable-static + - --disable-programs + - --disable-doc + - --enable-gpl + - --enable-shared + - --enable-libvorbis + - --enable-libopus + - --enable-libvpx + - --enable-postproc + sources: + - type: git + url: https://github.com/FFmpeg/FFmpeg.git + tag: n5.1.4 + + - name: freeimage + no-autogen: true + build-options: + cxxflags: -std=c++14 + make-args: + - DESTDIR=/app + sources: + - type: archive + url: http://downloads.sourceforge.net/freeimage/FreeImage3180.zip + sha256: f41379682f9ada94ea7b34fe86bf9ee00935a3147be41b6569c9605a53e438fd + - type: shell + commands: + - sed -i 's|-o root -g root ||' ./Makefile.gnu + - sed -i 's|/usr|/app|' ./Makefile.gnu + + - name: libgit2 + buildsystem: cmake-ninja + config-opts: + - -DCMAKE_BUILD_TYPE=Release + - -DBUILD_SHARED_LIBS:BOOL=ON + - -DTHREADSAFE=ON + sources: + - type: git + url: https://github.com/libgit2/libgit2.git + tag: v1.6.3 + + # Needed from ES-DE 2.1.0+ + - name: libpoppler-glib + buildsystem: cmake-ninja + config-opts: + - -DENABLE_BOOST=OFF + sources: + - type: archive + # original link not working, found a mirror + url: https://poppler.freedesktop.org/poppler-22.11.0.tar.xz + #url: https://gitlab.freedesktop.org/poppler/poppler/-/archive/poppler-22.11.0/poppler-poppler-22.11.0.tar.bz2 + sha256: 093ba9844ed774285517361c15e21a31ba4df278a499263d4403cca74f2da828 + cleanup: + - /lib/pkgconfig + - /include + - '*.a' + - '*.la' + + # When updating this module remember to check those on the main repos: + - name: ES-DE + buildsystem: cmake-ninja + config-opts: + - -DRETRODECK=on + cleanup: + - es-app + - es-core + sources: + - type: git + url: https://github.com/XargonWan/RetroDECK-ES-DE + branch: retrodeck-main + - type: shell + + # ES-DE - END + + # ES-DE Themes - START + + - name: art-book-next-es-de + buildsystem: simple + build-commands: + - mkdir -p ${FLATPAK_DEST}/share/es-de/themes/art-book-next-es-de/ + - mv -f * ${FLATPAK_DEST}/share/es-de/themes/art-book-next-es-de/ + sources: + - type: git + url: https://github.com/anthonycaccese/art-book-next-es-de.git + commit: 4fe896af7447404f6ea083335cd661c91b0f7860 + + # ES-DE Themes - END \ No newline at end of file diff --git a/manifest-header.yml b/manifest-header.yml new file mode 100644 index 000000000..fb3665f6d --- /dev/null +++ b/manifest-header.yml @@ -0,0 +1,57 @@ +app-id: net.retrodeck.es-de +runtime: org.kde.Platform +runtime-version: "6.7" +sdk: org.kde.Sdk +sdk-extensions: + - org.freedesktop.Sdk.Extension.llvm18 # Needed for RPCS3 +command: retrodeck.sh + +finish-args: + - --socket=wayland + - --socket=x11 + - --socket=pulseaudio + - --share=ipc + - --share=network + - --device=all + - --filesystem=host + - --filesystem=home/.var/app/com.valvesoftware.Steam + - --allow=multiarch + - --talk-name=org.freedesktop.ScreenSaver + - --talk-name=org.freedesktop.PowerManagement.Inhibit + - --talk-name=org.freedesktop.login1.Manager + - --filesystem=xdg-run/app/com.discordapp.Discord:create + - --filesystem=xdg-config/gtk-3.0:ro + - --env=QT_QPA_PLATFORM=wayland;wayland-egl;xcb + # Dolphin + - --allow=bluetooth + # It allows an SDL application to specify its window class, which can be useful for window managers and desktop environments to identify and group similar windows + - --env=SDL_VIDEO_X11_WMCLASS=net.retrodeck.retrodeck + - --env=SDL_VIDEO_WAYLAND_WMCLASS=net.retrodeck.retrodeck + # XEMU - Fixes issues with openSUSE systems, QEMU_AUDIO_DRV is defined as "pa" causing xemu to not launch + - --unset-env=QEMU_AUDIO_DRV + # BoilR + - --filesystem=xdg-data/Steam:rw #Steam (flatpak) + - --filesystem=~/.steam:rw # Steam (Non-flatpak) + - --filesystem=~/.var/app/com.valvesoftware.Steam:rw # Steam (Flatpak) + # PPSSPP, DOLPHIN + - --filesystem=xdg-run/gamescope-0:ro + +cleanup: + # ES-DE + - /include + - /share/ffmpeg + - /lib/cmake + - /lib/pkgconfig + - /include + - /bin/glslangValidator + - /bin/zip* + - /bin/zstd* + - /lib/pkg-config + - /share/doc + - /share/man + - /src + - '*.a' + - '*.la' + # XMLSTARLET + - /lib/debug + - /share/runtime diff --git a/update_es-de_manifest.sh b/update_es-de_manifest.sh new file mode 100644 index 000000000..e69de29bb