From 988a9d208c7215b0acfef2493ada66880b99cb2c Mon Sep 17 00:00:00 2001 From: XargonWan Date: Fri, 22 Dec 2023 11:03:23 +0100 Subject: [PATCH] First workflow version --- .github/workflows/build_mame.yml | 86 +++++------------------- automation_tools/update_mame_manifest.sh | 2 +- net.retrodeck.mame | 82 ---------------------- 3 files changed, 19 insertions(+), 151 deletions(-) diff --git a/.github/workflows/build_mame.yml b/.github/workflows/build_mame.yml index 68569a2..3d5ae58 100644 --- a/.github/workflows/build_mame.yml +++ b/.github/workflows/build_mame.yml @@ -28,101 +28,51 @@ jobs: - name: "Creating MAME manifest" run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/update_mame_manifest.sh" - - name: "Adding flatpak portal for automated updates (cooker only)" - run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_flatpak_portal_add.sh" - - - name: "Updating release notes in appdata" - run: "automation_tools/appdata_management.sh" - - name: "[DEBUG] Outputting manifest" - run: cat net.retrodeck.retrodeck.yml + run: cat net.retrodeck.mame.yml - - name: "Build flatpak: download only" + - name: "Build flatpak" id: "flatpak-download" - run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh" - continue-on-error: true - - # Sometimes flatpak download fails, in this case it tries a second time - - name: "Build flatpak: download only (retry)" - if: steps.flatpak-download.outcome == 'failure' run: | - echo "Download failed, maybe some hash changed since the build start." - echo "Recalculating hashes and retrying download..." - rm -f "{GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml" - cp "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak" "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml" - "${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh" - "${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh" + flatpak-builder --user --force-clean \ + --install-deps-from=flathub \ + --install-deps-from=flathub-beta \ + --repo=${GITHUB_WORKSPACE}/mame-repo \ + "${GITHUB_WORKSPACE}" \ + net.retrodeck.mame.yml - - name: Build flatpak - run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only.sh" - - - name: Create Artifact for flathub + - name: Create Artifact for RetroDECK run: | - tar -czf ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.tar.gz -C ${GITHUB_WORKSPACE}/retrodeck-flatpak-cooker . - hash=($(sha256sum ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.tar.gz)) + tar -czf ${GITHUB_WORKSPACE}/RetroDECK-MAME-Artifact.tar.gz -C ${GITHUB_WORKSPACE}/mame-repo . + hash=($(sha256sum ${GITHUB_WORKSPACE}/RetroDECK-MAME-Artifact.tar.gz)) echo $hash > ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.sha mv -f RetroDECK-Artifact-cooker.* ${{ secrets.ARTIFACT_REPO }} continue-on-error: true - - name: Create Bundle - run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle.sh" - - name: Set environment variable with current branch name run: echo "GITHUB_REF_SLUG=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV - - name: Get commits since last release - run: | - # Get the latest release tag - LATEST_TAG=$(git describe --tags --abbrev=0) - # Get all commits since the latest release tag - COMMITS=$(git log $LATEST_TAG..HEAD --pretty=format:"- %s") - # Set the output variable - echo "::set-output name=commits::$COMMITS" - id: commits - continue-on-error: true - - name: Get branch name id: branch_name run: echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV - # if it's a feature branch it will not marked as "latest" cooker version - - name: "Set makeLatest (cooker only)" - run: | - if [[ "$BRANCH_NAME" == 'feat/'* ]]; then - echo "MAKE_LATEST=false" >> $GITHUB_ENV - else - echo "MAKE_LATEST=true" >> $GITHUB_ENV - fi - - name: Publish the flatpak in a new cooker release uses: ncipollo/release-action@v1 with: tag: "${{env.BRANCH_NAME}}-${{ env.buildid }}" body: | # Release Notes (Cooker) - This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}. + These are the artifact of RetroDECK MAME, commit: ${{ github.event.repository.full_name }}@${{github.sha}}. On branch [${{env.BRANCH_NAME}}](https://github.com/XargonWan/RetroDECK/tree/${{env.BRANCH_NAME}}). - ## Commits since last release - ${{ steps.commits.outputs.commits }} - - For the full release note for this build please refer to the channel [#BETA-TESTING](https://discord.gg/qQcrFvaA2C) on our Discord server. - - Cooker channel is provided for the community to test fixes and explore new functionality. - Please DO NOT open issues or ask support on this build. - - artifacts: "RetroDECK-cooker.flatpak,RetroDECK-Artifact.tar.gz" + artifacts: "RetroDECK-MAME-Artifact.tar.gz" allowUpdates: true - makeLatest: ${{env.MAKE_LATEST}} # if it's a feat branch is not considered the latest build + makeLatest: true token: ${{ secrets.TRIGGER_BUILD_TOKEN }} - repo: RetroDECK-cooker continue-on-error: true - # In case it cannot publish the release at least it's providing the flatpak file for creating a manual release - - name: Upload RetroDECK-cooker.flatpak - uses: actions/upload-artifact@v3 - with: - name: retrodeck-flatpak - path: RetroDECK-cooker.flatpak - continue-on-error: true + - name: "Committing changes" + uses: EndBug/add-and-commit@v9.1.3 + + diff --git a/automation_tools/update_mame_manifest.sh b/automation_tools/update_mame_manifest.sh index 0328f2b..d4bbc3d 100755 --- a/automation_tools/update_mame_manifest.sh +++ b/automation_tools/update_mame_manifest.sh @@ -14,7 +14,7 @@ sed -i 's/[[:space:]]*#.*$//' "$manifest_header" sed -i 's/net.retrodeck.retrodeck/net.retrodeck.mame/' "$manifest_header" sed -i 's/retrodeck\.sh/mame/' "$manifest_header" -cat "$manifest_header" >> "$mame_manifest" +cat "$manifest_header" > "$mame_manifest" cat "$mame_module" >> "$mame_manifest" rm -rf RetroDECK \ No newline at end of file diff --git a/net.retrodeck.mame b/net.retrodeck.mame index a6feb68..d0578a0 100644 --- a/net.retrodeck.mame +++ b/net.retrodeck.mame @@ -6,88 +6,6 @@ sdk-extensions: - org.freedesktop.Sdk.Extension.llvm16 command: mame -add-extensions: - org.ppsspp.PPSSPP.Locale: - directory: share/locale - bundle: true - no-autodownload: false - subdirectories: false - autodelete: true - locale-subset: true - -finish-args: - - --socket=fallback-x11 - - --socket=wayland - - --socket=pulseaudio - - --share=ipc - - --share=network - - --device=all - - --filesystem=home - - --filesystem=/run/media - - --filesystem=/media - - --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 - - --talk-name=org.freedesktop.portal.Flatpak.UpdateMonitor - - --filesystem=xdg-run/app/com.discordapp.Discord:create - - --allow=bluetooth - - --env=SDL_VIDEO_X11_WMCLASS=net.retrodeck.mame - - --env=SDL_VIDEO_WAYLAND_WMCLASS=net.retrodeck.mame - - --unset-env=QEMU_AUDIO_DRV - - - name: mame - buildsystem: simple - build-options: - no-debuginfo: true - strip: true - build-commands: - - make - -j echo $(nproc) - CFLAGS+=-Wno-error=restrict - USE_QTDEBUG=0 - USE_WAYLAND=1 - USE_SYSTEM_LIB_FLAC=1 - SDL_INI_PATH='$$HOME/.APP_NAME;/app/share/APP_NAME/ini' - LDOPTS=-Wl,-s - - install -Dm 0755 mame ${FLATPAK_DEST}/bin/mame - - cp COPYING ${FLATPAK_DEST}/bin/ - - cp uismall.bdf ${FLATPAK_DEST}/bin/ - - mkdir -p ${FLATPAK_DEST}/share/mame/ - - cp -r artwork/ ${FLATPAK_DEST}/share/mame/ - - cp -r bgfx/ ${FLATPAK_DEST}/share/mame/ - - cp -r ctrlr/ ${FLATPAK_DEST}/share/mame/ - - mkdir -p ${FLATPAK_DEST}/share/mame/docs/ - - cp -r docs/legal/ ${FLATPAK_DEST}/share/mame/docs/ - - cp -r docs/man/ ${FLATPAK_DEST}/share/mame/docs - - cp -r hash/ ${FLATPAK_DEST}/share/mame/ - - cp -r hlsl/ ${FLATPAK_DEST}/share/mame/ - - cp -r ini/ ${FLATPAK_DEST}/share/mame/ - - install -Dm 0644 mame.ini ${FLATPAK_DEST}/share/mame/ini/mame.ini - - cp -r language/ ${FLATPAK_DEST}/share/mame/ - - cp -r plugins/ ${FLATPAK_DEST}/share/mame/ - - cp -r roms/ ${FLATPAK_DEST}/share/mame/ - - cp -r samples/ ${FLATPAK_DEST}/share/mame/ - sources: - - type: archive - url: https://github.com/mamedev/mame/archive/refs/tags/mame0261.tar.gz - sha256: 51d5ce1563897709ceb7a924c31a70cc5ff2bec466aab8d0cc9ff3cc72b38899 - - type: file - path: mame-patches/mame.ini - - type: patch - path: mame-patches/floppy.patch - - type: patch - path: mame-patches/sound.patch - - type: patch - path: mame-patches/ym3802.patchapp-id: net.retrodeck.mame -runtime: org.kde.Platform -runtime-version: "6.5" -sdk: org.kde.Sdk -sdk-extensions: - - org.freedesktop.Sdk.Extension.llvm16 -command: mame - add-extensions: org.ppsspp.PPSSPP.Locale: directory: share/locale