@@ -63,14 +63,22 @@ jobs:
6363 outputs :
6464 create_artifacts : ${{ steps.config.outputs.create_artifacts }}
6565 cache_date : ${{ steps.config.outputs.cache_date }}
66+ flatpak_matrix : ${{ steps.config.outputs.flatpak_matrix }}
6667 steps :
6768 - name : ' Configure Build Jobs'
6869 id : config
6970 run : |
7071 if [[ "${{ github.event_name == 'pull_request' }}" == "true" ]]; then
7172 echo "create_artifacts=${{ contains(github.event.pull_request.labels.*.name, 'Seeking Testers') }}" >> $GITHUB_OUTPUT
73+
74+ if [[ "${{ contains(github.event.pull_request.labels.*.name, 'Flatpak aarch64') }}" == true ]]; then
75+ echo 'flatpak_matrix=["x86_64","aarch64"]' >> $GITHUB_OUTPUT
76+ else
77+ echo 'flatpak_matrix=["x86_64"]' >> $GITHUB_OUTPUT
78+ fi
7279 else
7380 echo 'create_artifacts=true' >> $GITHUB_OUTPUT
81+ echo 'flatpak_matrix=["x86_64"]' >> $GITHUB_OUTPUT
7482 fi
7583 echo "cache_date=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
7684
@@ -333,8 +341,8 @@ jobs:
333341 name : ' obs-studio-windows-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
334342 path : ' ${{ env.FILE_NAME }}'
335343
336- linux_package :
337- name : ' 02 - Flatpak'
344+ flatpak_deps_build :
345+ name : ' 02 - Flatpak Dependencies '
338346 runs-on : [ubuntu-latest]
339347 needs : [config, clang_check]
340348 defaults :
@@ -343,6 +351,10 @@ jobs:
343351 container :
344352 image : bilelmoussaoui/flatpak-github-actions:kde-6.4
345353 options : --privileged
354+ strategy :
355+ matrix : ${{ fromJSON(needs.config.outputs.flatpak_matrix) }}
356+ outputs :
357+ cache_key : ${{ steps.setup.outputs.cache_key }}
346358 steps :
347359
348360 - name : ' Checkout'
@@ -355,29 +367,90 @@ jobs:
355367 id : setup
356368 env :
357369 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
358- CACHE_KEY : flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
370+ SKIP_MODULE : 5
359371 run : |
360- dnf install -y -q gh
372+ if [[ "${{ matrix.arch }}" != "x86_64" ]]; then
373+ dnf install -y -q gh docker
374+ else
375+ dnf install -y -q gh
376+ fi
361377 gh extension install actions/gh-actions-cache
362378
363379 git config --global --add safe.directory $GITHUB_WORKSPACE
364380
365- KEY="$CACHE_KEY-x86_64"
381+ # Generating the key without skipped modules and cleanup objects
382+ CACHE_KEY=$(jq "del(.cleanup) | del(.modules[].cleanup) | del(.modules[-$SKIP_MODULE:])" CI/flatpak/com.obsproject.Studio.json | sha256sum | cut -d " " -f 1)
383+
384+ KEY="$CACHE_KEY-${{ matrix.arch }}"
366385 CACHE_HIT=$(gh actions-cache list -B master --key $KEY | grep -q $KEY && echo 'true' || echo 'false')
367386
368- echo "git_hash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT
369387 echo "cache_key=$CACHE_KEY" >> $GITHUB_OUTPUT
370388 echo "cache_hit=$CACHE_HIT" >> $GITHUB_OUTPUT
389+ echo "stop_at_module=$(jq ".modules[-$SKIP_MODULE].name" CI/flatpak/com.obsproject.Studio.json | tr -d '"')" >> $GITHUB_OUTPUT
390+
391+ - name : Setup QEMU
392+ if : ${{ (matrix.arch != 'x86_64') && !fromJSON(steps.setup.output.cache_hit) }}
393+ uses : docker/setup-qemu-action@v2
394+ with :
395+ platform : arm64
396+
397+ - name : Build Flatpak Manifest
398+ if : ${{ !fromJSON(steps.setup.output.cache_hit) }}
399+ uses : flatpak/flatpak-github-actions/flatpak-builder@83ec7c1998a152b7d47507a2da5d7a4b21e612ff
400+ with :
401+ stop-at-module : ${{ steps.setup.outputs.stop_at_module }}
402+ manifest-path : CI/flatpak/com.obsproject.Studio.json
403+ cache : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
404+ restore-cache : false
405+ cache-key : ${{ steps.setup.outputs.cache_key }}
406+ arch : ${{ matrix.arch }}
407+
408+ flatpak_build :
409+ name : ' 03 - Flatpak'
410+ runs-on : [ubuntu-latest]
411+ needs : [config, flatpak_deps_build]
412+ defaults :
413+ run :
414+ shell : bash
415+ container :
416+ image : bilelmoussaoui/flatpak-github-actions:kde-6.4
417+ options : --privileged
418+ strategy :
419+ matrix : ${{ fromJSON(needs.config.outputs.flatpak_matrix) }}
420+ steps :
421+
422+ - name : ' Checkout'
423+ uses : actions/checkout@v3
424+ with :
425+ submodules : ' recursive'
426+ fetch-depth : 0
427+
428+ - name : ' Setup build environment'
429+ id : setup
430+ env :
431+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
432+ CACHE_KEY : flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
433+ run : |
434+ [[ "${{ matrix.arch }}" != "x86_64" ]] && dnf install -y -q docker
435+
436+ git config --global --add safe.directory $GITHUB_WORKSPACE
437+
438+ echo "git_hash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT
439+
440+ - name : Setup QEMU
441+ if : ${{ matrix.arch != 'x86_64' }}
442+ uses : docker/setup-qemu-action@v2
443+ with :
444+ platform : arm64
371445
372446 - name : Build Flatpak Manifest
373447 uses : flatpak/flatpak-github-actions/flatpak-builder@83ec7c1998a152b7d47507a2da5d7a4b21e612ff
374448 with :
375449 build-bundle : ${{ fromJSON(needs.config.outputs.create_artifacts) }}
376450 bundle : obs-studio-flatpak-${{ steps.setup.outputs.git_hash }}.flatpak
377451 manifest-path : CI/flatpak/com.obsproject.Studio.json
378- cache : ${{ fromJSON(steps.setup.outputs.cache_hit) || (github.event_name == 'push' && github.ref == 'refs/heads/master') }}
379- restore-cache : ${{ fromJSON(steps.setup.outputs.cache_hit) }}
380- cache-key : ${{ steps.setup.outputs.cache_key }}
452+ cache-key : ${{ needs.flatpak_deps_build.outputs.cache_key }}
453+ arch : ${{ matrix.arch }}
381454
382455 windows_package :
383456 name : ' 03 - Windows Installer'
@@ -550,7 +623,7 @@ jobs:
550623 id : branch
551624 run : |
552625 pushd repo
553-
626+
554627 GIT_TAG="$(git describe --tags --abbrev=0)"
555628 if [[ ${GIT_TAG} == *'beta'* || ${GIT_TAG} == *'rc'* ]]; then
556629 echo "branch=beta" >> $GITHUB_OUTPUT
0 commit comments