Skip to content

Commit 1191df5

Browse files
committed
CI: Add Flatpak aarch64 build
1 parent 3d917fe commit 1191df5

File tree

1 file changed

+77
-5
lines changed

1 file changed

+77
-5
lines changed

.github/workflows/main.yml

Lines changed: 77 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ jobs:
7171
IS_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
7272
outputs:
7373
create_artifacts: ${{ steps.config.outputs.create_artifacts }}
74+
flatpak_matrix: ${{ steps.config.outputs.flatpak_matrix }}
7475
cache_date: ${{ steps.config.outputs.cache_date }}
7576
steps:
7677
- name: 'Configure Build Jobs'
@@ -82,8 +83,15 @@ jobs:
8283
else
8384
echo 'create_artifacts=false' >> $GITHUB_OUTPUT
8485
fi
86+
87+
if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Flatpak aarch64")')"; then
88+
echo 'flatpak_matrix=["x86_64", "aarch64"]' >> $GITHUB_OUTPUT
89+
else
90+
echo 'flatpak_matrix=["x86_64"]' >> $GITHUB_OUTPUT
91+
fi
8592
else
8693
echo 'create_artifacts=true' >> $GITHUB_OUTPUT
94+
echo 'flatpak_matrix=["x86_64"]' >> $GITHUB_OUTPUT
8795
fi
8896
echo "cache_date=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
8997
@@ -364,8 +372,8 @@ jobs:
364372
name: 'obs-studio-windows-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
365373
path: '${{ env.FILE_NAME }}'
366374

367-
linux_package:
368-
name: '02 - Flatpak'
375+
flatpak_deps_build:
376+
name: '02 - Flatpak Dependencies'
369377
runs-on: [ubuntu-latest]
370378
needs: [config, clang_check]
371379
defaults:
@@ -374,6 +382,9 @@ jobs:
374382
container:
375383
image: bilelmoussaoui/flatpak-github-actions:kde-6.4
376384
options: --privileged
385+
strategy:
386+
matrix:
387+
arch: ${{ fromJSON(needs.config.outputs.flatpak_matrix) }}
377388
steps:
378389

379390
- name: 'Checkout'
@@ -384,18 +395,79 @@ jobs:
384395

385396
- name: 'Setup build environment'
386397
run: |
398+
if [[ "${{ matrix.arch }}" != "x86_64" ]]; then
399+
dnf install -y -q jq docker
400+
else
401+
dnf install -y -q jq
402+
fi
403+
387404
git config --global --add safe.directory $GITHUB_WORKSPACE
388-
echo "OBS_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
405+
406+
echo "MANIFEST_HASH=$(cat CI/flatpak/com.obsproject.Studio.json | sha256sum | cut -d " " -f 1)" >> $GITHUB_ENV
407+
408+
- name: Setup QEMU
409+
if: ${{ matrix.arch != 'x86_64' }}
410+
uses: docker/setup-qemu-action@v2
411+
with:
412+
platforms: arm64
413+
414+
- name: 'Shorten Manifest'
415+
run: |
416+
jq 'del(.modules[-2:]) | .modules += [{"name": "obs", "buildsystem": "simple", "build-commands": ["cp -a /usr/bin/ls /app/bin/obs"]}]' CI/flatpak/com.obsproject.Studio.json > tmp.json
417+
mv tmp.json CI/flatpak/com.obsproject.Studio.json
418+
419+
- name: Build Flatpak Manifest
420+
uses: flatpak/flatpak-github-actions/flatpak-builder@v5
421+
with:
422+
build-bundle: false
423+
manifest-path: CI/flatpak/com.obsproject.Studio.json
424+
cache-key: flatpak-builder-${{ env.MANIFEST_HASH }}
425+
arch: ${{ matrix.arch }}
426+
427+
flatpak_build:
428+
name: '03 - Flatpak'
429+
runs-on: [ubuntu-latest]
430+
needs: [config, flatpak_deps_build]
431+
defaults:
432+
run:
433+
shell: bash
434+
container:
435+
image: bilelmoussaoui/flatpak-github-actions:kde-6.4
436+
options: --privileged
437+
strategy:
438+
matrix:
439+
arch: ${{ fromJSON(needs.config.outputs.flatpak_matrix) }}
440+
steps:
441+
442+
- name: 'Checkout'
443+
uses: actions/checkout@v3
444+
with:
445+
submodules: 'recursive'
446+
fetch-depth: 0
447+
448+
- name: 'Setup build environment'
449+
run: |
450+
[[ "${{ matrix.arch }}" != "x86_64" ]] && dnf install -y -q docker
451+
452+
git config --global --add safe.directory $GITHUB_WORKSPACE
453+
389454
echo "OBS_GIT_HASH=$(git rev-parse --short=9 HEAD)" >> $GITHUB_ENV
390-
echo "OBS_GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
455+
echo "MANIFEST_HASH=$(cat CI/flatpak/com.obsproject.Studio.json | sha256sum | cut -d " " -f 1)" >> $GITHUB_ENV
456+
457+
- name: Setup QEMU
458+
if: ${{ matrix.arch != 'x86_64' }}
459+
uses: docker/setup-qemu-action@v2
460+
with:
461+
platforms: arm64
391462

392463
- name: Build Flatpak Manifest
393464
uses: flatpak/flatpak-github-actions/flatpak-builder@v5
394465
with:
395466
build-bundle: ${{ fromJSON(needs.config.outputs.create_artifacts) }}
396467
bundle: obs-studio-flatpak-${{ env.OBS_GIT_HASH }}.flatpak
397468
manifest-path: CI/flatpak/com.obsproject.Studio.json
398-
cache-key: flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
469+
cache-key: flatpak-builder-${{ env.MANIFEST_HASH }}
470+
arch: ${{ matrix.arch }}
399471

400472
windows_package:
401473
name: '03 - Windows Installer'

0 commit comments

Comments
 (0)