From 0701a4124b06aa5a958a22422163b1fa1b7aff6f Mon Sep 17 00:00:00 2001 From: XargonWan Date: Sat, 24 Aug 2024 00:01:32 +0900 Subject: [PATCH] Adding manifest and workflow --- .github/workflows/build_artifacts.yml | 103 +++++++++++++++++++++++ automation_tools/install_dependencies.sh | 31 +++++++ automation_tools/update_manifest.sh | 22 +++++ manifest-header.yml | 37 ++++++++ module.yml | 6 ++ net.retrodeck.supermodel.xml | 30 +++++++ update_from_upstream.sh | 4 + 7 files changed, 233 insertions(+) create mode 100644 .github/workflows/build_artifacts.yml create mode 100755 automation_tools/install_dependencies.sh create mode 100755 automation_tools/update_manifest.sh create mode 100644 manifest-header.yml create mode 100644 module.yml create mode 100644 net.retrodeck.supermodel.xml create mode 100755 update_from_upstream.sh diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml new file mode 100644 index 0000000..3c52565 --- /dev/null +++ b/.github/workflows/build_artifacts.yml @@ -0,0 +1,103 @@ +name: "Build supermodel Artifacts for RetroDECK" + +on: + push: + branches: + - master + workflow_dispatch: + + +jobs: + + Building_Supermodel: + 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/supermodel-runner/_work/Supermodel/Supermodel/.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 supermodel manifest" + # run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/update_supermodel_manifest.sh" + + # - name: "[DEBUG] Outputting manifest" + # run: cat net.retrodeck.supermodel.yml + + - name: "Build flatpak" + id: "flatpak-download" + run: | + git config --global protocol.file.allow always + flatpak-builder --user --force-clean \ + --install-deps-from=flathub \ + --install-deps-from=flathub-beta \ + --repo=${GITHUB_WORKSPACE}/supermodel-repo \ + "${GITHUB_WORKSPACE}"/supermodel-build-dir \ + net.retrodeck.supermodel.yaml + + - name: "Exporting dir tree" + id: tree + run: tree -H ./ > ${GITHUB_WORKSPACE}/tree.html + + - name: Create Artifact for RetroDECK + run: | + tar -czf ${GITHUB_WORKSPACE}/Supermodel-Artifact.tar.gz -C ${GITHUB_WORKSPACE}/supermodel-build-dir . + hash=($(sha256sum ${GITHUB_WORKSPACE}/Supermodel-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 new release + uses: ncipollo/release-action@v1 + with: + tag: "${{env.BRANCH_NAME}}-${{env.DATE}}" + body: | + # Release Notes + These are the artifact of RetroDECK supermodel, commit: ${{ github.event.repository.full_name }}@${{github.sha}}. + On branch [${{env.BRANCH_NAME}}](https://github.com/XargonWan/Supermodel/tree/${{env.BRANCH_NAME}}). + + artifacts: "Supermodel-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.supermodel.yml + # git commit -m '[AUTOMATED] Updating supermodel 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 supermodel after build [skip ci]' + # branch: retrodeck-main + # continue-on-error: true # TODO: would be good to update the manifest but it's broken \ No newline at end of file diff --git a/automation_tools/install_dependencies.sh b/automation_tools/install_dependencies.sh new file mode 100755 index 0000000..3daa4ed --- /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_manifest.sh b/automation_tools/update_manifest.sh new file mode 100755 index 0000000..e32ad21 --- /dev/null +++ b/automation_tools/update_manifest.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +git clone https://github.com/XargonWan/RetroDECK --depth=1 RetroDECK + +# Creating MAME manifest +manifest_header="manifest-header.yml" +module="module.yml" +output_manifest="net.retrodeck.supermodel.yml" +command="/app/bin/supermodel" + +# 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.supermodel/' "$manifest_header" + +cat "$manifest_header" > "$output_manifest" +cat "$module" >> "$output_manifest" + +rm -rf RetroDECK \ No newline at end of file diff --git a/manifest-header.yml b/manifest-header.yml new file mode 100644 index 0000000..3bfcd57 --- /dev/null +++ b/manifest-header.yml @@ -0,0 +1,37 @@ +app-id: net.retrodeck.supermodel +runtime: org.kde.Platform +# runtime-version: "6.5" +runtime-version: 5.15-23.08 # maybe solving the libflac issue? +sdk: org.kde.Sdk +command: /app/bin/mame + +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 + diff --git a/module.yml b/module.yml new file mode 100644 index 0000000..548fd69 --- /dev/null +++ b/module.yml @@ -0,0 +1,6 @@ +modules: + + - name: supermodel + buildsystem: simple + build-commands: + - make -f Makefiles/Makefile.UNIX NET_BOARD=1 diff --git a/net.retrodeck.supermodel.xml b/net.retrodeck.supermodel.xml new file mode 100644 index 0000000..d2e9c65 --- /dev/null +++ b/net.retrodeck.supermodel.xml @@ -0,0 +1,30 @@ + + + net.retrodeck.supermodel.desktop + CC0-1.0 + GPL-3.0 + supermodel Launcher + Browse and play your supermodel quest collection. + +

+ supermodel Launcher is a desktop GUI frontend that allows to browse and play to supermodel quests, which are video games made with the supermodel game engine. +

+
+ + + https://www.supermodel-games.org/data/en/entities/article/old/2016/07/images/supermodel-launcher.png + + + https://www.supermodel-games.org/ + christopho@supermodel-games.org + ​net.retrodeck.supermodel.desktop + supermodel + supermodel Team + + moderate + mild + + + + +
diff --git a/update_from_upstream.sh b/update_from_upstream.sh new file mode 100755 index 0000000..52ffd41 --- /dev/null +++ b/update_from_upstream.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +git fetch https://github.com/flathub/net.retrodeck.supermodel master # Fetch the latest changes from the remote master branch +git merge FETCH_HEAD # Merge the fetched changes into your current branch \ No newline at end of file