-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Add Flatpak aarch64 builds (Part 1: build) #9979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
d32f1be
ca628b9
7086a35
3caa572
50f7702
b22ef95
0a74df6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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}" \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not really happy about introducing a bespoke label just for this, but code-wise it's fine.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could work and make the aarch64 build happen on PR if a cache is there and a label to force the build without cache. Note that the label name can be discussed. |
||
| | 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 | ||
|
|
@@ -243,79 +249,19 @@ 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 | ||
| 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 }}-${{ matrix.arch }}.flatpak | ||
| arch: ${{ matrix.arch }} | ||
| secrets: inherit | ||
| permissions: | ||
| contents: read | ||
|
|
||
| windows-build: | ||
| name: Windows 🪟 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,199 @@ | ||
| name: Flatpak Build | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| arch: | ||
| description: Architecture of the build | ||
| default: x86_64 | ||
tytan652 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| type: string | ||
| 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-until-90: | ||
| name: Build Modules Until 90-* 🧾 | ||
tytan652 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| runs-on: ubuntu-22.04 | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| 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 | ||
| 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 and jq tool' | ||
| dnf install -y -q gh jq | ||
| gh extension install actions/gh-actions-cache | ||
| echo '::endgroup::' | ||
|
|
||
| if [[ "${{ inputs.arch }}" != "x86_64" ]]; then | ||
tytan652 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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}-${{ inputs.arch }}" | head -1)" | ||
|
|
||
| if [[ "${key}" ]]; then | ||
| echo "cacheHit=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "cacheHit=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| 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: | ||
| artifact: manifest | ||
| path: build-aux/com.obsproject.Studio.json | ||
| validateToPublish: false | ||
|
|
||
| - name: Build Modules 🧱 | ||
| 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-${{ 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-${{ inputs.arch }} | ||
| path: flatpak-build-until-90-${{ inputs.arch }}.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}" | ||
|
|
||
| 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-${{ inputs.arch }} | ||
|
|
||
| - name: Extract Modules Artifact 🗜️ | ||
| if: ${{ !fromJSON(needs.build-until-90.outputs.cacheHit) }} | ||
| 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 | ||
| 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 | ||
| with: | ||
| artifact: builddir | ||
| path: flatpak_app | ||
| validateToPublish: false | ||
|
|
||
| - name: Validate repository | ||
| uses: ./.github/actions/flatpak-builder-lint | ||
| with: | ||
| 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-${{ inputs.arch }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather have this step create a bespoke matrix variable instead of putting this in
config_data, as described in the GitHub action documentation:https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/expressions#example-returning-a-json-object
I'm fine with
flatpakArchbeing set up as a bespoke output variable depending on GitHub event.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assigning a whole matrix looks unnecessary, making the JSON object (only an array) more complex (an array in an object) where there is only one variable does not look worth it.
I was aware of this feature to set up a matrix but for one variable, it looks too much.