Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 75 additions & 13 deletions .github/workflows/flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ jobs:

case ${GITHUB_REF##*/} in
+([0-9]).+([0-9]).+([0-9]) )
echo 'valid_tag=${{ toJSON(true) }}' >> $GITHUB_OUTPUT
echo 'valid_tag=true' >> $GITHUB_OUTPUT
echo 'matrix=["beta", "stable"]' >> $GITHUB_OUTPUT
;;
+([0-9]).+([0-9]).+([0-9])-@(beta|rc)*([0-9]) )
echo 'valid_tag=${{ toJSON(true) }}' >> $GITHUB_OUTPUT
echo 'valid_tag=true' >> $GITHUB_OUTPUT
echo 'matrix=["beta"]' >> $GITHUB_OUTPUT
;;
* ) echo 'valid_tag=${{ toJSON(false) }}' >> $GITHUB_OUTPUT ;;
* ) echo 'valid_tag=false' >> $GITHUB_OUTPUT ;;
esac

publish:
name: Publish to Flathub
prepare:
name: Build Dependencies
runs-on: [ubuntu-latest]
needs: check_tag
if: fromJSON(needs.check_tag.outputs.valid_tag)
Expand All @@ -54,7 +54,9 @@ jobs:
options: --privileged
strategy:
matrix:
branch: ${{ fromJSON(needs.check_tag.outputs.matrix) }}
arch: [x86_64, aarch64]
output:
cache_key: ${{ steps.setup.outputs.cache_key }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -65,29 +67,89 @@ jobs:
id: setup
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CACHE_KEY: flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
SKIP_MODULE: 5
run: |
dnf install -y -q gh
if [[ "${{ matrix.arch }}" != "x86_64" ]]; then
dnf install -y -q gh jq docker
else
dnf install -y -q gh jq
fi
gh extension install actions/gh-actions-cache

git config --global --add safe.directory $GITHUB_WORKSPACE

KEY="$CACHE_KEY-x86_64"
# Generating the key without skipped modules and cleanup objects
CACHE_KEY=flatpak-builder-$(jq "del(.cleanup) | del(.modules[].cleanup) | del(.modules[-$SKIP_MODULE:])" CI/flatpak/com.obsproject.Studio.json | sha256sum | cut -d " " -f 1)

KEY="$CACHE_KEY-${{ matrix.arch }}"
CACHE_HIT=$(gh actions-cache list -B master --key $KEY | grep -q $KEY && echo 'true' || echo 'false')

echo "git_hash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT
echo "cache_key=$CACHE_KEY" >> $GITHUB_OUTPUT
echo "cache_hit=$CACHE_HIT" >> $GITHUB_OUTPUT
echo "stop_at_module=$(jq ".modules[-$SKIP_MODULE].name" CI/flatpak/com.obsproject.Studio.json | tr -d '"')" >> $GITHUB_OUTPUT

- name: Setup QEMU
if: ${{ (matrix.arch != 'x86_64') && !fromJSON(steps.setup.outputs.cache_hit) }}
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Build Flatpak Manifest
if: ${{ !fromJSON(steps.setup.outputs.cache_hit) }}
uses: flatpak/flatpak-github-actions/flatpak-builder@83ec7c1998a152b7d47507a2da5d7a4b21e612ff
with:
bundle: obs-studio-${{ steps.setup.outputs.git_hash }}.flatpak
stop-at-module: ${{ steps.setup.outputs.stop_at_module }}
manifest-path: CI/flatpak/com.obsproject.Studio.json
cache: ${{ fromJSON(steps.setup.outputs.cache_hit) }}
cache-key: ${{ steps.setup.outputs.cache_key }}
arch: ${ {matrix.arch }}

publish:
name: Publish to Flathub
runs-on: [ubuntu-latest]
needs: check_tag
if: fromJSON(needs.check_tag.outputs.valid_tag)
env:
FLATPAK_BUILD_PATH: flatpak_app/files/share
container:
image: bilelmoussaoui/flatpak-github-actions:kde-6.4
options: --privileged
strategy:
matrix:
branch: ${{ fromJSON(needs.check_tag.outputs.matrix) }}
arch: [x86_64, aarch64]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: 'Setup build environment'
id: setup
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CACHE_KEY: flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
run: |
[[ "${{ matrix.arch }}" != "x86_64" ]] && dnf install -y -q docker

git config --global --add safe.directory $GITHUB_WORKSPACE

echo "git_hash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT

- name: Setup QEMU
if: ${{ matrix.arch != 'x86_64' }}
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Build Flatpak Manifest
uses: flatpak/flatpak-github-actions/flatpak-builder@83ec7c1998a152b7d47507a2da5d7a4b21e612ff
with:
bundle: obs-studio-${{ steps.setup.outputs.git_hash }}.flatpak
manifest-path: CI/flatpak/com.obsproject.Studio.json
cache-key: ${{ needs.prepare.outputs.cache_key }}
mirror-screenshots-url: https://dl.flathub.org/repo/screenshots
branch: ${{ matrix.branch }}
arch: ${{ matrix.arch }}

- name: Validate AppStream
shell: bash
Expand All @@ -104,7 +166,7 @@ jobs:

- name: Commit screenshots to the OSTree repository
run: |
ostree commit --repo=repo --canonical-permissions --branch=screenshots/x86_64 flatpak_app/screenshots
ostree commit --repo=repo --canonical-permissions --branch=screenshots/${{ matrix.arch }} flatpak_app/screenshots

- name: Publish to Flathub Beta
uses: flatpak/flatpak-github-actions/flat-manager@v5
Expand Down
95 changes: 85 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,22 @@ jobs:
outputs:
create_artifacts: ${{ steps.config.outputs.create_artifacts }}
cache_date: ${{ steps.config.outputs.cache_date }}
flatpak_matrix: ${{ steps.config.outputs.flatpak_matrix }}
steps:
- name: 'Configure Build Jobs'
id: config
run: |
if [[ "${{ github.event_name == 'pull_request' }}" == "true" ]]; then
echo "create_artifacts=${{ contains(github.event.pull_request.labels.*.name, 'Seeking Testers') }}" >> $GITHUB_OUTPUT

if [[ "${{ contains(github.event.pull_request.labels.*.name, 'Flatpak aarch64') }}" == true ]]; then
echo 'flatpak_matrix=["x86_64", "aarch64"]' >> $GITHUB_OUTPUT
else
echo 'flatpak_matrix=["x86_64"]' >> $GITHUB_OUTPUT
fi
else
echo 'create_artifacts=true' >> $GITHUB_OUTPUT
echo 'flatpak_matrix=["x86_64"]' >> $GITHUB_OUTPUT
fi
echo "cache_date=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT

Expand Down Expand Up @@ -333,8 +341,8 @@ jobs:
name: 'obs-studio-windows-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
path: '${{ env.FILE_NAME }}'

linux_package:
name: '02 - Flatpak'
flatpak_deps_build:
name: '02 - Flatpak Dependencies'
runs-on: [ubuntu-latest]
needs: [config, clang_check]
defaults:
Expand All @@ -343,6 +351,11 @@ jobs:
container:
image: bilelmoussaoui/flatpak-github-actions:kde-6.4
options: --privileged
strategy:
matrix:
arch: ${{ fromJSON(needs.config.outputs.flatpak_matrix) }}
outputs:
cache_key: ${{ steps.setup.outputs.cache_key }}
steps:

- name: 'Checkout'
Expand All @@ -355,29 +368,91 @@ jobs:
id: setup
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CACHE_KEY: flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
SKIP_MODULE: 5
run: |
dnf install -y -q gh
if [[ "${{ matrix.arch }}" != "x86_64" ]]; then
dnf install -y -q gh jq docker
else
dnf install -y -q gh jq
fi
gh extension install actions/gh-actions-cache

git config --global --add safe.directory $GITHUB_WORKSPACE

KEY="$CACHE_KEY-x86_64"
# Generating the key without skipped modules and cleanup objects
CACHE_KEY=flatpak-builder-$(jq "del(.cleanup) | del(.modules[].cleanup) | del(.modules[-$SKIP_MODULE:])" CI/flatpak/com.obsproject.Studio.json | sha256sum | cut -d " " -f 1)

KEY="$CACHE_KEY-${{ matrix.arch }}"
CACHE_HIT=$(gh actions-cache list -B master --key $KEY | grep -q $KEY && echo 'true' || echo 'false')

echo "git_hash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT
echo "cache_key=$CACHE_KEY" >> $GITHUB_OUTPUT
echo "cache_hit=$CACHE_HIT" >> $GITHUB_OUTPUT
echo "stop_at_module=$(jq ".modules[-$SKIP_MODULE].name" CI/flatpak/com.obsproject.Studio.json | tr -d '"')" >> $GITHUB_OUTPUT

- name: Setup QEMU
if: ${{ (matrix.arch != 'x86_64') && !fromJSON(steps.setup.outputs.cache_hit) }}
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Build Flatpak Manifest
if: ${{ !fromJSON(steps.setup.outputs.cache_hit) }}
uses: flatpak/flatpak-github-actions/flatpak-builder@83ec7c1998a152b7d47507a2da5d7a4b21e612ff
with:
stop-at-module: ${{ steps.setup.outputs.stop_at_module }}
manifest-path: CI/flatpak/com.obsproject.Studio.json
cache: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || matrix.arch != 'x86_64' }}
restore-cache: false
cache-key: ${{ steps.setup.outputs.cache_key }}
arch: ${{ matrix.arch }}

flatpak_build:
name: '03 - Flatpak'
runs-on: [ubuntu-latest]
needs: [config, flatpak_deps_build]
defaults:
run:
shell: bash
container:
image: bilelmoussaoui/flatpak-github-actions:kde-6.4
options: --privileged
strategy:
matrix:
arch: ${{ fromJSON(needs.config.outputs.flatpak_matrix) }}
steps:

- name: 'Checkout'
uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: 0

- name: 'Setup build environment'
id: setup
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CACHE_KEY: flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
run: |
[[ "${{ matrix.arch }}" != "x86_64" ]] && dnf install -y -q docker

git config --global --add safe.directory $GITHUB_WORKSPACE

echo "git_hash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT

- name: Setup QEMU
if: ${{ matrix.arch != 'x86_64' }}
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Build Flatpak Manifest
uses: flatpak/flatpak-github-actions/flatpak-builder@83ec7c1998a152b7d47507a2da5d7a4b21e612ff
with:
build-bundle: ${{ fromJSON(needs.config.outputs.create_artifacts) }}
bundle: obs-studio-flatpak-${{ steps.setup.outputs.git_hash }}.flatpak
manifest-path: CI/flatpak/com.obsproject.Studio.json
cache: ${{ fromJSON(steps.setup.outputs.cache_hit) || (github.event_name == 'push' && github.ref == 'refs/heads/master') }}
restore-cache: ${{ fromJSON(steps.setup.outputs.cache_hit) }}
cache-key: ${{ steps.setup.outputs.cache_key }}
cache-key: ${{ needs.flatpak_deps_build.outputs.cache_key }}
arch: ${{ matrix.arch }}

windows_package:
name: '03 - Windows Installer'
Expand Down Expand Up @@ -550,7 +625,7 @@ jobs:
id: branch
run: |
pushd repo

GIT_TAG="$(git describe --tags --abbrev=0)"
if [[ ${GIT_TAG} == *'beta'* || ${GIT_TAG} == *'rc'* ]]; then
echo "branch=beta" >> $GITHUB_OUTPUT
Expand Down
36 changes: 34 additions & 2 deletions CI/flatpak/com.obsproject.Studio.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@
"name": "svt-av1",
"buildsystem": "cmake-ninja",
"builddir": true,
"only-arches": [
"x86_64"
],
"config-opts": [
"-DCMAKE_BUILD_TYPE=Release",
"-DBUILD_SHARED_LIBS=ON",
Expand Down Expand Up @@ -265,6 +268,15 @@
"commands": [
"patch -Np1 -i obs-deps/deps.ffmpeg/patches/FFmpeg/0001-FFmpeg-6.0-OBS.patch"
]
},
{
"type": "shell",
"skip-arches": [
"x86_64"
],
"commands": [
"sed -i 's/enabled libsvtav1 &&/disable libsvtav1 #/g' configure # Disable SVT-AV1 on non-x86_64"
]
}
]
},
Expand Down Expand Up @@ -486,8 +498,28 @@
"sources": [
{
"type": "archive",
"url": "https://cdn-fastly.obsproject.com/downloads/cef_binary_5060_linux64.tar.bz2",
"sha256": "ac4e2a8ebf20700e4e36353e314f876623633dd5b474778a2548bb66bdbea11d"
"only-arches": [
"x86_64"
],
"url": "https://cdn-fastly.obsproject.com/downloads/cef_binary_5060_linux_x86_64.tar.xz",
"sha256": "bf4aa9388bab7e94fa945cc3bba16b6da63b6a30f9c0342d42235468b39d84bf"
},
{
"type": "archive",
"only-arches": [
"aarch64"
],
"url": "https://cdn-fastly.obsproject.com/downloads/cef_binary_5060_linux_aarch64.tar.xz",
"sha256": "68d915c9ba2639cba762a54cd3430fce2527aa6355d831d3cfcb6157664206b0"
},
{
"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"
]
}
]
},
Expand Down