From 51e43a9e159a70908f8944006d34925c6a179398 Mon Sep 17 00:00:00 2001 From: Bart Piotrowski Date: Wed, 21 Feb 2024 20:31:17 +0100 Subject: [PATCH] ci: Switch Flatpak build to flathub-infra/flatpak-github-actions Flathub team has recently forked flatpak-github-actions and merged various PRs submitted to the original repo. However, it's not versioned (yet?), so pin the latest commit instead. Additionally, enable validation of the build using flatpak-builder-lint, and run all steps in the container with the runtime and required tooling baked in. --- .github/workflows/linux_build_flatpak.yml | 35 ++++------- .../scripts/linux/install-packages-flatpak.sh | 58 ------------------- 2 files changed, 12 insertions(+), 81 deletions(-) delete mode 100755 .github/workflows/scripts/linux/install-packages-flatpak.sh diff --git a/.github/workflows/linux_build_flatpak.yml b/.github/workflows/linux_build_flatpak.yml index 5a02be3115e68e..e00026a8da5e7b 100644 --- a/.github/workflows/linux_build_flatpak.yml +++ b/.github/workflows/linux_build_flatpak.yml @@ -34,7 +34,7 @@ on: patchesUrl: required: false type: string - default: https://github.com/PCSX2/pcsx2_patches/releases/latest/download + default: https://github.com/PCSX2/pcsx2_patches/releases/download/latest/patches.zip fetchTags: required: false type: boolean @@ -48,6 +48,9 @@ jobs: build_linux: name: ${{ inputs.jobName }} runs-on: ${{ inputs.os }} + container: + image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.6 + options: --privileged timeout-minutes: 60 steps: @@ -81,29 +84,23 @@ jobs: PR_SHA: ${{ github.event.pull_request.head.sha }} run: ./.github/workflows/scripts/common/name-artifacts.sh - - name: Install Packages - env: - COMPILER: ${{ inputs.compiler }} - run: .github/workflows/scripts/linux/install-packages-flatpak.sh - - name: Download patches run: | cd bin/resources - aria2c -Z "${{ inputs.patchesUrl }}/patches.zip" + wget "${{ inputs.patchesUrl }}/patches.zip" - name: Generate AppStream XML run: | ./.github/workflows/scripts/linux/generate-metainfo.sh .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml cat .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml - flatpak run org.freedesktop.appstream-glib validate .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml + flatpak-builder-lint appstream .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml - name: Validate manifest run: | - flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json + flatpak-builder-lint org.flatpak.Builder manifest .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json - name: Build Flatpak - # TODO - based on v6.3, switch back to the main action once change is accepted (or they release a breaking change that uses upload-artifact@v4) - uses: xTVaser/flatpak-github-actions/flatpak-builder@64267d4cf01f7955a40128039d0abab17bb48aac + uses: flathub-infra/flatpak-github-actions/flatpak-builder@23796715b3dfa4c86ddf50cf29c3cc8b3c82dca8 with: bundle: ${{ steps.artifact-metadata.outputs.artifact-name }}.flatpak upload-artifact: false @@ -117,21 +114,13 @@ jobs: restore-cache: true cache-key: ${{ inputs.os }} ${{ inputs.platform }} ${{ inputs.compiler }} flatpak ${{ hashFiles('.github/workflows/scripts/linux/flatpak/**/*.json') }} - - name: Commit screenshots to OSTree + - name: Validate build run: | - ostree commit --repo=repo --canonical-permissions --branch=screenshots/x86_64 flatpak_app/screenshots - - #- name: Validate build directory - # run: | - # flatpak run --command=flatpak-builder-lint org.flatpak.Builder builddir flatpak_app - # - #- name: Validate repo - # run: | - # flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo repo + flatpak-builder-lint org.flatpak.Builder --exceptions repo flatpak_app - name: Push to Flathub beta if: inputs.publish == true && inputs.branch == 'beta' - uses: flatpak/flatpak-github-actions/flat-manager@v6.3 + uses: flathub-infra/flatpak-github-actions/flat-manager@23796715b3dfa4c86ddf50cf29c3cc8b3c82dca8 with: flat-manager-url: https://hub.flathub.org/ repository: beta @@ -139,7 +128,7 @@ jobs: - name: Push to Flathub stable if: inputs.publish == true && inputs.branch == 'stable' - uses: flatpak/flatpak-github-actions/flat-manager@v6.3 + uses: flathub-infra/flatpak-github-actions/flat-manager@23796715b3dfa4c86ddf50cf29c3cc8b3c82dca8 with: flat-manager-url: https://hub.flathub.org/ repository: stable diff --git a/.github/workflows/scripts/linux/install-packages-flatpak.sh b/.github/workflows/scripts/linux/install-packages-flatpak.sh deleted file mode 100755 index ccbbd86a2ce79f..00000000000000 --- a/.github/workflows/scripts/linux/install-packages-flatpak.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}") -source "$SCRIPTDIR/functions.sh" - -set -e - -ARCH=x86_64 -KDE_BRANCH=6.6 -BRANCH=23.08 -FLAT_MANAGER_CLIENT_DIR="$HOME/.local/bin" - -# Build packages. Mostly needed for flat-manager-client. -declare -a BUILD_PACKAGES=( - "flatpak" - "flatpak-builder" - "appstream-util" - "python3-aiohttp" - "python3-tenacity" - "python3-gi" - "gobject-introspection" - "libappstream-glib8" - "libappstream-glib-dev" - "libappstream-dev" - "gir1.2-ostree-1.0" -) - -# Flatpak runtimes and SDKs. -declare -a FLATPAK_PACKAGES=( - "org.kde.Platform/${ARCH}/${KDE_BRANCH}" - "org.kde.Sdk/${ARCH}/${KDE_BRANCH}" - "org.freedesktop.Platform.ffmpeg-full/${ARCH}/${BRANCH}" - "org.freedesktop.Sdk.Extension.llvm17/${ARCH}/${BRANCH}" - "org.freedesktop.appstream-glib/${ARCH}/stable" -) - -retry_command sudo apt-get -qq update - -# Install packages needed for building -echo "Will install the following packages for building - ${BUILD_PACKAGES[*]}" -retry_command sudo apt-get -y install "${BUILD_PACKAGES[@]}" - -sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - -# Install packages needed for building -echo "Will install the following packages for building - ${FLATPAK_PACKAGES[*]}" -retry_command sudo flatpak -y install "${FLATPAK_PACKAGES[@]}" - -echo "Installing Flatpak Builder" -retry_command sudo flatpak -y install flathub org.flatpak.builder - -echo "Downloading flat-manager-client" -mkdir -p "$FLAT_MANAGER_CLIENT_DIR" -pushd "$FLAT_MANAGER_CLIENT_DIR" -aria2c -Z "https://raw.githubusercontent.com/flatpak/flat-manager/9401efbdc0d6bd489507d8401c567ba219d735d5/flat-manager-client" -chmod +x flat-manager-client -echo "$FLAT_MANAGER_CLIENT_DIR" >> $GITHUB_PATH -popd