From d32f1bea1a746cd7c13db63c4cd36a8571b35963 Mon Sep 17 00:00:00 2001 From: tytan652 Date: Thu, 31 Aug 2023 09:31:26 +0200 Subject: [PATCH 1/7] plugins: Change obs-qsv11 enablement to reject unsupported architecture --- plugins/CMakeLists.txt | 8 +++++++- plugins/obs-qsv11/CMakeLists.txt | 6 ++++++ plugins/obs-qsv11/cmake/legacy.cmake | 14 +++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 90bea35be27345..3c5aba161ac7cf 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -33,6 +33,12 @@ if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0) endif() endmacro() + macro(check_obs_qsv11) + if(OS_WINDOWS OR (OS_LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3-6]86|x86|x64|x86_64|amd64|AMD64)$")) + add_subdirectory(obs-qsv11) + endif() + endmacro() + # Add plugins in alphabetical order to retain order in IDE projects add_subdirectory(aja) if(OS_WINDOWS OR OS_MACOS) @@ -63,8 +69,8 @@ if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0) add_subdirectory(obs-ffmpeg) add_subdirectory(obs-filters) add_subdirectory(obs-outputs) + check_obs_qsv11() if(OS_WINDOWS) - add_subdirectory(obs-qsv11) add_subdirectory(obs-text) endif() add_subdirectory(obs-transitions) diff --git a/plugins/obs-qsv11/CMakeLists.txt b/plugins/obs-qsv11/CMakeLists.txt index 7a6f5d831aaed7..b6d90cb7982c67 100644 --- a/plugins/obs-qsv11/CMakeLists.txt +++ b/plugins/obs-qsv11/CMakeLists.txt @@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.22...3.25) legacy_check() +if(NOT OS_LINUX OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3-6]86|x86|x64|x86_64|amd64|AMD64)$") + set(_enable_qsv11 TRUE) +else() + set(_enable_qsv11 FALSE) +endif() + option(ENABLE_QSV11 "Build Intel QSV11 Hardware Encoder." TRUE) if(NOT ENABLE_QSV11) target_disable_feature(obs-qsv11 "Intel QSV11 Hardware Encoder") diff --git a/plugins/obs-qsv11/cmake/legacy.cmake b/plugins/obs-qsv11/cmake/legacy.cmake index 34a445bde2433c..8ab46125fb688e 100644 --- a/plugins/obs-qsv11/cmake/legacy.cmake +++ b/plugins/obs-qsv11/cmake/legacy.cmake @@ -1,9 +1,21 @@ -option(ENABLE_QSV11 "Build Intel QSV11 Hardware Encoder." TRUE) +if(NOT OS_LINUX OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3-6]86|x86|x64|x86_64|amd64|AMD64)$") + set(_enable_qsv11 TRUE) +else() + set(_enable_qsv11 FALSE) +endif() + +option(ENABLE_QSV11 "Build Intel QSV11 Hardware Encoder." _enable_qsv11) if(NOT ENABLE_QSV11) obs_status(DISABLED "obs-qsv11") return() +elseif(NOT _enable_qsv11) + message( + FATAL_ERROR + "QSV plugin is not compatible with ${CMAKE_SYSTEM_PROCESSOR} architecture.\n Disable this error by setting ENABLE_QSV11 to OFF." + ) endif() +unset(_enable_qsv11) project(obs-qsv11) From ca628b9bd419a33e112ba3f8589492d1b8563ab5 Mon Sep 17 00:00:00 2001 From: tytan652 Date: Thu, 31 Aug 2023 09:01:19 +0200 Subject: [PATCH 2/7] build-aux: Disable QSV on non-x86_64 architecture None of Intel runtime supports non-x86_64 arches --- build-aux/com.obsproject.Studio.json | 3 +-- build-aux/modules/50-intel-media-sdk.json | 3 +++ build-aux/modules/50-onevpl-intel-gpu.json | 3 +++ build-aux/modules/50-onevpl.json | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/build-aux/com.obsproject.Studio.json b/build-aux/com.obsproject.Studio.json index 37d898d851fbd4..4e45a3d90b958d 100644 --- a/build-aux/com.obsproject.Studio.json +++ b/build-aux/com.obsproject.Studio.json @@ -85,8 +85,7 @@ "-DENABLE_RTMPS=ON", "-DENABLE_VLC=OFF", "-DENABLE_AJA=ON", - "-DENABLE_LIBFDK=ON", - "-DENABLE_QSV11=ON" + "-DENABLE_LIBFDK=ON" ], "secret-opts": [ "-DRESTREAM_CLIENTID=$RESTREAM_CLIENTID", diff --git a/build-aux/modules/50-intel-media-sdk.json b/build-aux/modules/50-intel-media-sdk.json index 8f52b5c2139863..1e2d5c935e86da 100644 --- a/build-aux/modules/50-intel-media-sdk.json +++ b/build-aux/modules/50-intel-media-sdk.json @@ -1,5 +1,8 @@ { "name": "intel-media-sdk", + "only-arches": [ + "x86_64" + ], "buildsystem": "cmake-ninja", "builddir": true, "config-opts": [ diff --git a/build-aux/modules/50-onevpl-intel-gpu.json b/build-aux/modules/50-onevpl-intel-gpu.json index 3613012b99d500..4750596129f365 100644 --- a/build-aux/modules/50-onevpl-intel-gpu.json +++ b/build-aux/modules/50-onevpl-intel-gpu.json @@ -1,5 +1,8 @@ { "name": "onevpl-intel-gpu", + "only-arches": [ + "x86_64" + ], "buildsystem": "cmake-ninja", "builddir": true, "config-opts": [ diff --git a/build-aux/modules/50-onevpl.json b/build-aux/modules/50-onevpl.json index fc6e88227dcb4b..191d4a4ea039b0 100644 --- a/build-aux/modules/50-onevpl.json +++ b/build-aux/modules/50-onevpl.json @@ -1,5 +1,8 @@ { "name": "onevpl", + "only-arches": [ + "x86_64" + ], "buildsystem": "cmake-ninja", "builddir": true, "config-opts": [ From 7086a35bdf0559b37a61d590242c61125eb68c7c Mon Sep 17 00:00:00 2001 From: tytan652 Date: Wed, 30 Aug 2023 13:53:34 +0200 Subject: [PATCH 3/7] build-aux: Add aarch64 support to Flatpak manifest --- build-aux/modules/99-cef.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/build-aux/modules/99-cef.json b/build-aux/modules/99-cef.json index 23bf14cd64eed0..f5c0a50ead765f 100644 --- a/build-aux/modules/99-cef.json +++ b/build-aux/modules/99-cef.json @@ -21,8 +21,28 @@ "sources": [ { "type": "archive", + "only-arches": [ + "x86_64" + ], "url": "https://cdn-fastly.obsproject.com/downloads/cef_binary_5060_linux_x86_64_v3.tar.xz", "sha256": "1253a6a36c3b8ac5b5ece9bfdb6eae6ab75e49516375fc475e2e871795ad9bea" + }, + { + "type": "archive", + "only-arches": [ + "aarch64" + ], + "url": "https://cdn-fastly.obsproject.com/downloads/cef_binary_5060_linux_aarch64_v3.tar.xz", + "sha256": "66ebcfce94a4527c8dd085a685691d0c43291adab9f2be4f8a0762f4a614083a" + }, + { + "type": "shell", + "only-arches": [ + "aarch64" + ], + "commands": [ + "sed -i 's/set(PROJECT_ARCH \"x86_64\")/set(PROJECT_ARCH \"aarch64\")/g' cmake/cef_variables.cmake # Fix PROJECT_ARCH on aarch64" + ] } ] } From 3caa572f4e86e9878d0eab9fe5279ea6e942b699 Mon Sep 17 00:00:00 2001 From: tytan652 Date: Wed, 30 Aug 2023 13:56:54 +0200 Subject: [PATCH 4/7] CI: Move Flatpak workflow as reusable Reusable workflow can have a matrix applied to the whole workflow which cleanly workaround job with a matrix not having outputs per iteration --- .github/workflows/build-project.yaml | 79 +++---------------------- .github/workflows/flatpak-build.yaml | 87 ++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 72 deletions(-) create mode 100644 .github/workflows/flatpak-build.yaml diff --git a/.github/workflows/build-project.yaml b/.github/workflows/build-project.yaml index 697afccd2ab031..d4783bbe5e4230 100644 --- a/.github/workflows/build-project.yaml +++ b/.github/workflows/build-project.yaml @@ -243,79 +243,14 @@ jobs: flatpak-build: name: Flatpak ๐Ÿ“ฆ - runs-on: ubuntu-22.04 needs: check-event - defaults: - run: - shell: bash - container: - image: bilelmoussaoui/flatpak-github-actions:kde-6.5 - options: --privileged - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - set-safe-directory: ${{ env.GITHUB_WORKSPACE }} - - - name: Set Up Environment ๐Ÿ”ง - id: setup - env: - GH_TOKEN: ${{ github.token }} - run: | - : Set Up Environment ๐Ÿ”ง - if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi - - git config --global --add safe.directory "${GITHUB_WORKSPACE}" - - echo '::group::Install GitHub CLI tool' - dnf install -y -q gh - gh extension install actions/gh-actions-cache - echo '::endgroup::' - - cache_key='flatpak-builder-${{ hashFiles('build-aux/**/*.json') }}' - cache_ref='master' - read -r key size unit _ ref _ <<< \ - "$(gh actions-cache list -B ${cache_ref} --key "${cache_key}-x86_64" | head -1)" - - if [[ "${key}" ]]; then - echo "cacheHit=true" >> $GITHUB_OUTPUT - else - echo "cacheHit=false" >> $GITHUB_OUTPUT - fi - - echo "cacheKey=${cache_key}" >> $GITHUB_OUTPUT - - - name: Validate Flatpak manifest - uses: ./.github/actions/flatpak-builder-lint - with: - artifact: manifest - path: build-aux/com.obsproject.Studio.json - validateToPublish: false - - - name: Build Flatpak Manifest ๐Ÿงพ - uses: flatpak/flatpak-github-actions/flatpak-builder@0ab9dd6a6afa6fe7e292db0325171660bf5b6fdf - with: - build-bundle: ${{ fromJSON(needs.check-event.outputs.package) }} - bundle: obs-studio-flatpak-${{ needs.check-event.outputs.commitHash }}.flatpak - manifest-path: ${{ github.workspace }}/build-aux/com.obsproject.Studio.json - cache: ${{ fromJSON(steps.setup.outputs.cacheHit) || (github.event_name == 'push' && github.ref_name == 'master')}} - restore-cache: ${{ fromJSON(steps.setup.outputs.cacheHit) }} - cache-key: ${{ steps.setup.outputs.cacheKey }} - - - name: Validate build directory - uses: ./.github/actions/flatpak-builder-lint - with: - artifact: builddir - path: flatpak_app - validateToPublish: false - - - name: Validate repository - uses: ./.github/actions/flatpak-builder-lint - with: - artifact: repo - path: repo - validateToPublish: false + uses: ./.github/workflows/flatpak-build.yaml + with: + build-bundle: ${{ fromJSON(needs.check-event.outputs.package) }} + bundle: obs-studio-flatpak-${{ needs.check-event.outputs.commitHash }}.flatpak + secrets: inherit + permissions: + contents: read windows-build: name: Windows ๐ŸชŸ diff --git a/.github/workflows/flatpak-build.yaml b/.github/workflows/flatpak-build.yaml new file mode 100644 index 00000000000000..4a381a541abc61 --- /dev/null +++ b/.github/workflows/flatpak-build.yaml @@ -0,0 +1,87 @@ +name: Flatpak Build +on: + workflow_call: + inputs: + build-bundle: + description: Build a bundle and upload it as an artifact + default: true + type: boolean + bundle: + description: Name of the bundle + default: obs-studio-flatpak.flatpak + type: string +jobs: + build: + name: Build ๐Ÿงพ + runs-on: ubuntu-22.04 + defaults: + run: + shell: bash + container: + image: bilelmoussaoui/flatpak-github-actions:kde-6.5 + options: --privileged + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + set-safe-directory: ${{ env.GITHUB_WORKSPACE }} + + - name: Set Up Environment ๐Ÿ”ง + id: setup + env: + GH_TOKEN: ${{ github.token }} + run: | + : Set Up Environment ๐Ÿ”ง + if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi + + git config --global --add safe.directory "${GITHUB_WORKSPACE}" + + echo '::group::Install GitHub CLI tool' + dnf install -y -q gh + gh extension install actions/gh-actions-cache + echo '::endgroup::' + + cache_key='flatpak-builder-${{ hashFiles('build-aux/**/*.json') }}' + cache_ref='master' + read -r key size unit _ ref _ <<< \ + "$(gh actions-cache list -B ${cache_ref} --key "${cache_key}-x86_64" | head -1)" + + if [[ "${key}" ]]; then + echo "cacheHit=true" >> $GITHUB_OUTPUT + else + echo "cacheHit=false" >> $GITHUB_OUTPUT + fi + + echo "cacheKey=${cache_key}" >> $GITHUB_OUTPUT + + - name: Validate Flatpak manifest + uses: ./.github/actions/flatpak-builder-lint + with: + artifact: manifest + path: build-aux/com.obsproject.Studio.json + validateToPublish: false + + - name: Build Flatpak Manifest ๐Ÿงฑ + uses: flatpak/flatpak-github-actions/flatpak-builder@0ab9dd6a6afa6fe7e292db0325171660bf5b6fdf + with: + build-bundle: ${{ fromJSON(inputs.build-bundle) }} + bundle: ${{ inputs.bundle }} + manifest-path: ${{ github.workspace }}/build-aux/com.obsproject.Studio.json + cache: ${{ fromJSON(steps.setup.outputs.cacheHit) || (github.event_name == 'push' && github.ref_name == 'master')}} + restore-cache: fromJSON(steps.setup.outputs.cacheHit) }} + cache-key: ${{ steps.setup.outputs.cacheKey }} + + - name: Validate build directory + uses: ./.github/actions/flatpak-builder-lint + with: + artifact: builddir + path: flatpak_app + validateToPublish: false + + - name: Validate repository + uses: ./.github/actions/flatpak-builder-lint + with: + artifact: repo + path: repo + validateToPublish: false From 50f7702aa5576bf27de83514d2cb890f7dcc4d5b Mon Sep 17 00:00:00 2001 From: tytan652 Date: Fri, 8 Dec 2023 14:21:54 +0100 Subject: [PATCH 5/7] CI: Split Flatpak in multiple jobs This allows to workaround the 6 hours time limit per job. This is needed to enable to build Flatpak with QEMU emulation. --- .github/workflows/flatpak-build.yaml | 91 +++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 8 deletions(-) diff --git a/.github/workflows/flatpak-build.yaml b/.github/workflows/flatpak-build.yaml index 4a381a541abc61..690d13e8c85e87 100644 --- a/.github/workflows/flatpak-build.yaml +++ b/.github/workflows/flatpak-build.yaml @@ -11,12 +11,15 @@ on: default: obs-studio-flatpak.flatpak type: string jobs: - build: - name: Build ๐Ÿงพ + build-until-90: + name: Build Modules Until 90-* ๐Ÿงพ runs-on: ubuntu-22.04 defaults: run: shell: bash + outputs: + cacheKey: ${{ steps.setup.outputs.cacheKey }} + cacheHit: ${{ steps.setup.outputs.cacheHit }} container: image: bilelmoussaoui/flatpak-github-actions:kde-6.5 options: --privileged @@ -37,11 +40,14 @@ jobs: git config --global --add safe.directory "${GITHUB_WORKSPACE}" - echo '::group::Install GitHub CLI tool' - dnf install -y -q gh + echo '::group::Install GitHub CLI and jq tool' + dnf install -y -q gh jq gh extension install actions/gh-actions-cache echo '::endgroup::' + stop_at_module=$(jq -r '.modules[:-1] | map(select(test("90-*")))[0]' build-aux/com.obsproject.Studio.json) + echo "stopAtModule=$(jq -r '.name' build-aux/$stop_at_module)" >> $GITHUB_OUTPUT + cache_key='flatpak-builder-${{ hashFiles('build-aux/**/*.json') }}' cache_ref='master' read -r key size unit _ ref _ <<< \ @@ -62,15 +68,72 @@ jobs: path: build-aux/com.obsproject.Studio.json validateToPublish: false - - name: Build Flatpak Manifest ๐Ÿงฑ + - name: Build Modules ๐Ÿงฑ + if: ${{ !fromJSON(steps.setup.outputs.cacheHit) }} + uses: flatpak/flatpak-github-actions/flatpak-builder@0ab9dd6a6afa6fe7e292db0325171660bf5b6fdf + with: + manifest-path: ${{ github.workspace }}/build-aux/com.obsproject.Studio.json + stop-at-module: ${{ steps.setup.outputs.stopAtModule }} + cache: false + + - name: Prepare Modules Artifact ๐Ÿ—œ๏ธ + if: ${{ !fromJSON(steps.setup.outputs.cacheHit) }} + run: tar -cvf flatpak-build-until-90.tar .flatpak-builder + + - name: Upload Modules Artifact ๐Ÿ“ก + if: ${{ !fromJSON(steps.setup.outputs.cacheHit) }} + uses: actions/upload-artifact@v3 + with: + name: flatpak-build-until-90 + path: flatpak-build-until-90.tar + retention-days: 1 + + build-obs: + name: Build OBS Studio ๐Ÿงพ + runs-on: ubuntu-22.04 + needs: build-until-90 + defaults: + run: + shell: bash + container: + image: bilelmoussaoui/flatpak-github-actions:kde-6.5 + options: --privileged + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + set-safe-directory: ${{ env.GITHUB_WORKSPACE }} + + - name: Set Up Environment ๐Ÿ”ง + id: setup + env: + GH_TOKEN: ${{ github.token }} + run: | + : Set Up Environment ๐Ÿ”ง + if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi + + git config --global --add safe.directory "${GITHUB_WORKSPACE}" + + - name: Download Modules Artifact ๐Ÿ›ฐ๏ธ + if: ${{ !fromJSON(needs.build-until-90.outputs.cacheHit) }} + uses: actions/download-artifact@v3 + with: + name: flatpak-build-until-90 + + - name: Extract Modules Artifact ๐Ÿ—œ๏ธ + if: ${{ !fromJSON(needs.build-until-90.outputs.cacheHit) }} + run: tar -xvf flatpak-build-until-90.tar + + - name: Build Modules ๐Ÿงฑ uses: flatpak/flatpak-github-actions/flatpak-builder@0ab9dd6a6afa6fe7e292db0325171660bf5b6fdf with: build-bundle: ${{ fromJSON(inputs.build-bundle) }} bundle: ${{ inputs.bundle }} manifest-path: ${{ github.workspace }}/build-aux/com.obsproject.Studio.json - cache: ${{ fromJSON(steps.setup.outputs.cacheHit) || (github.event_name == 'push' && github.ref_name == 'master')}} - restore-cache: fromJSON(steps.setup.outputs.cacheHit) }} - cache-key: ${{ steps.setup.outputs.cacheKey }} + cache: ${{ fromJSON(needs.build-until-90.outputs.cacheHit) || (github.event_name == 'push' && github.ref_name == 'master')}} + restore-cache: ${{ fromJSON(needs.build-until-90.outputs.cacheHit) }} + cache-key: ${{ needs.build-until-90.outputs.cacheKey }} - name: Validate build directory uses: ./.github/actions/flatpak-builder-lint @@ -85,3 +148,15 @@ jobs: artifact: repo path: repo validateToPublish: false + + cleanup-artifact: + name: Cleanup Artifact ๐Ÿงน + runs-on: ubuntu-22.04 + needs: [build-until-90, build-obs] + if: ${{ !fromJSON(needs.build-until-90.outputs.cacheHit) }} + steps: + - name: Delete Modules Artifact ๐Ÿ—‘๏ธ + uses: geekyeggo/delete-artifact@v2 + with: + useGlob: false + name: flatpak-build-until-90 From b22ef9591f23c9a3fa69b263f4e289fbd1f06c65 Mon Sep 17 00:00:00 2001 From: tytan652 Date: Wed, 30 Aug 2023 15:35:14 +0200 Subject: [PATCH 6/7] CI: Add arch option to Flatpak build workflow --- .github/workflows/flatpak-build.yaml | 51 ++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/.github/workflows/flatpak-build.yaml b/.github/workflows/flatpak-build.yaml index 690d13e8c85e87..9ef0198d722620 100644 --- a/.github/workflows/flatpak-build.yaml +++ b/.github/workflows/flatpak-build.yaml @@ -2,6 +2,10 @@ name: Flatpak Build on: workflow_call: inputs: + arch: + description: Architecture of the build + default: x86_64 + type: string build-bundle: description: Build a bundle and upload it as an artifact default: true @@ -20,6 +24,7 @@ jobs: outputs: cacheKey: ${{ steps.setup.outputs.cacheKey }} cacheHit: ${{ steps.setup.outputs.cacheHit }} + qemuArch: ${{ steps.setup.outputs.qemuArch }} container: image: bilelmoussaoui/flatpak-github-actions:kde-6.5 options: --privileged @@ -45,13 +50,25 @@ jobs: gh extension install actions/gh-actions-cache echo '::endgroup::' + if [[ "${{ inputs.arch }}" != "x86_64" ]]; then + echo '::group::Install Docker' + dnf install -y -q docker + echo '::endgroup::' + + if [[ "${{ inputs.arch }}" == "aarch64" ]]; then + echo "qemuArch=arm64" >> $GITHUB_OUTPUT + else + echo "qemuArch=${{ inputs.arch }}" >> $GITHUB_OUTPUT + fi + fi + stop_at_module=$(jq -r '.modules[:-1] | map(select(test("90-*")))[0]' build-aux/com.obsproject.Studio.json) echo "stopAtModule=$(jq -r '.name' build-aux/$stop_at_module)" >> $GITHUB_OUTPUT cache_key='flatpak-builder-${{ hashFiles('build-aux/**/*.json') }}' cache_ref='master' read -r key size unit _ ref _ <<< \ - "$(gh actions-cache list -B ${cache_ref} --key "${cache_key}-x86_64" | head -1)" + "$(gh actions-cache list -B ${cache_ref} --key "${cache_key}-${{ inputs.arch }}" | head -1)" if [[ "${key}" ]]; then echo "cacheHit=true" >> $GITHUB_OUTPUT @@ -61,6 +78,12 @@ jobs: echo "cacheKey=${cache_key}" >> $GITHUB_OUTPUT + - name: Setup QEMU ๐Ÿฆค + if: ${{ (inputs.arch != 'x86_64') && !fromJSON(steps.setup.outputs.cacheHit) }} + uses: docker/setup-qemu-action@v2 + with: + platforms: ${{ steps.setup.outputs.qemuArch }} + - name: Validate Flatpak manifest uses: ./.github/actions/flatpak-builder-lint with: @@ -72,20 +95,21 @@ jobs: if: ${{ !fromJSON(steps.setup.outputs.cacheHit) }} uses: flatpak/flatpak-github-actions/flatpak-builder@0ab9dd6a6afa6fe7e292db0325171660bf5b6fdf with: + arch: ${{ inputs.arch }} manifest-path: ${{ github.workspace }}/build-aux/com.obsproject.Studio.json stop-at-module: ${{ steps.setup.outputs.stopAtModule }} cache: false - name: Prepare Modules Artifact ๐Ÿ—œ๏ธ if: ${{ !fromJSON(steps.setup.outputs.cacheHit) }} - run: tar -cvf flatpak-build-until-90.tar .flatpak-builder + run: tar -cvf flatpak-build-until-90-${{ inputs.arch }}.tar .flatpak-builder - name: Upload Modules Artifact ๐Ÿ“ก if: ${{ !fromJSON(steps.setup.outputs.cacheHit) }} uses: actions/upload-artifact@v3 with: - name: flatpak-build-until-90 - path: flatpak-build-until-90.tar + name: flatpak-build-until-90-${{ inputs.arch }} + path: flatpak-build-until-90-${{ inputs.arch }}.tar retention-days: 1 build-obs: @@ -115,19 +139,32 @@ jobs: git config --global --add safe.directory "${GITHUB_WORKSPACE}" + if [[ "${{ inputs.arch }}" != "x86_64" ]]; then + echo '::group::Install Docker' + dnf install -y -q docker + echo '::endgroup::' + fi + + - name: Setup QEMU ๐Ÿฆค + if: ${{ (inputs.arch != 'x86_64') && !fromJSON(needs.build-until-90.outputs.cacheHit) }} + uses: docker/setup-qemu-action@v2 + with: + platforms: ${{ needs.build-until-90.outputs.qemuArch }} + - name: Download Modules Artifact ๐Ÿ›ฐ๏ธ if: ${{ !fromJSON(needs.build-until-90.outputs.cacheHit) }} uses: actions/download-artifact@v3 with: - name: flatpak-build-until-90 + name: flatpak-build-until-90-${{ inputs.arch }} - name: Extract Modules Artifact ๐Ÿ—œ๏ธ if: ${{ !fromJSON(needs.build-until-90.outputs.cacheHit) }} - run: tar -xvf flatpak-build-until-90.tar + run: tar -xvf flatpak-build-until-90-${{ inputs.arch }}.tar - name: Build Modules ๐Ÿงฑ uses: flatpak/flatpak-github-actions/flatpak-builder@0ab9dd6a6afa6fe7e292db0325171660bf5b6fdf with: + arch: ${{ inputs.arch }} build-bundle: ${{ fromJSON(inputs.build-bundle) }} bundle: ${{ inputs.bundle }} manifest-path: ${{ github.workspace }}/build-aux/com.obsproject.Studio.json @@ -159,4 +196,4 @@ jobs: uses: geekyeggo/delete-artifact@v2 with: useGlob: false - name: flatpak-build-until-90 + name: flatpak-build-until-90-${{ inputs.arch }} From 0a74df6dfca79bbc859b042d9426b42b8d861827 Mon Sep 17 00:00:00 2001 From: tytan652 Date: Wed, 30 Aug 2023 17:58:23 +0200 Subject: [PATCH 7/7] CI: Enable aarch64 Flatpak build Requires a label to be enabled on pull requests --- .github/workflows/build-project.yaml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-project.yaml b/.github/workflows/build-project.yaml index d4783bbe5e4230..19a2da7883d7ab 100644 --- a/.github/workflows/build-project.yaml +++ b/.github/workflows/build-project.yaml @@ -14,6 +14,7 @@ jobs: notarize: ${{ steps.setup.outputs.notarize }} config: ${{ steps.setup.outputs.config }} commitHash: ${{ steps.setup.outputs.commitHash }} + flatpakArch: ${{ steps.setup.outputs.flatpakArch }} steps: - uses: actions/checkout@v3 with: @@ -28,25 +29,30 @@ jobs: case "${GITHUB_EVENT_NAME}" in pull_request) - config_data=('codesign:false' 'notarize:false' 'package:false' 'config:RelWithDebInfo') - if gh pr view ${{ github.event.number }} --json labels \ + config_data=('codesign:false' 'notarize:false' 'package:false' 'config:RelWithDebInfo' 'flatpakArch:["x86_64"]') + label_data=$(gh pr view ${{ github.event.number }} --json labels) + if echo "${label_data}" \ | jq -e -r '.labels[] | select(.name == "Seeking Testers")' > /dev/null; then config_data[0]='codesign:true' config_data[2]='package:true' fi + if echo "${label_data}" \ + | jq -e -r '.labels[] | select(.name == "Flatpak QEMU")' > /dev/null; then + config_data[5]='flatpakArch:["x86_64", "aarch64"]' + fi ;; push) - config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo') + config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo' 'flatpakArch:["x86_64", "aarch64"]') if [[ ${GITHUB_REF_NAME} =~ [0-9]+.[0-9]+.[0-9]+(-(rc|beta).+)? ]]; then config_data[1]='notarize:true' config_data[3]='config:Release' fi ;; workflow_dispatch) - config_data=('codesign:true' 'notarize:false' 'package:false' 'config:RelWithDebInfo') + config_data=('codesign:true' 'notarize:false' 'package:false' 'config:RelWithDebInfo' 'flatpakArch:["x86_64", "aarch64"]') ;; schedule) - config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo') + config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo' 'flatpakArch:["x86_64", "aarch64"]') ;; *) ;; esac @@ -245,9 +251,14 @@ jobs: name: Flatpak ๐Ÿ“ฆ needs: check-event uses: ./.github/workflows/flatpak-build.yaml + strategy: + fail-fast: false + matrix: + arch: ${{ fromJson(needs.check-event.outputs.flatpakArch) }} with: build-bundle: ${{ fromJSON(needs.check-event.outputs.package) }} - bundle: obs-studio-flatpak-${{ needs.check-event.outputs.commitHash }}.flatpak + bundle: obs-studio-flatpak-${{ needs.check-event.outputs.commitHash }}-${{ matrix.arch }}.flatpak + arch: ${{ matrix.arch }} secrets: inherit permissions: contents: read