Skip to content

Commit

Permalink
Add aarch64 support to the new workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tytan652 committed Aug 30, 2023
1 parent 3943065 commit 1f3a1fa
Showing 1 changed file with 42 additions and 7 deletions.
49 changes: 42 additions & 7 deletions .github/workflows/flatpak-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Flatpak Build
on:
workflow_call:
inputs:
arch:
default: x86_64
type: string
build-bundle:
default: true
type: boolean
Expand Down Expand Up @@ -44,10 +47,22 @@ 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::'
fi
if [[ "${{ inputs.arch }}" == "aarch64" ]]; then
echo "qemuArch=arm64" >> $GITHUB_OUTPUT
else
echo "qemuArch=${{ inputs.arch }}" >> $GITHUB_OUTPUT
fi
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
Expand All @@ -57,24 +72,31 @@ 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: ${{ step.setup.outputs.qemuArch }}

- name: Build Flatpak Manifest 🧾
if: ${{ !fromJSON(steps.setup.outputs.cacheHit) }}
uses: flatpak/flatpak-github-actions/flatpak-builder@1283416d7c0462e052ab0685d9444a7a48bfff3b
with:
arch: ${{ inputs.arch }}
manifest-path: ${{ github.workspace }}/build-aux/com.obsproject.Studio.json
stop-at-module: asio
cache: false

- name: Prepare Flatpak Deps Artifact
if: ${{ !fromJSON(steps.setup.outputs.cacheHit) }}
run: tar -cvf flatpak-builder-deps.tar .flatpak-builder
run: tar -cvf flatpak-builder-deps-${{ inputs.arch }}.tar .flatpak-builder

- name: Upload Flatpak Deps Artifact
if: ${{ !fromJSON(steps.setup.outputs.cacheHit) }}
uses: actions/upload-artifact@v3
with:
name: flatpak-builder-deps
path: flatpak-builder-deps.tar
name: flatpak-builder-deps-${{ inputs.arch }}
path: flatpak-builder-deps-${{ inputs.arch }}.tar
retention-days: 1

obs-build:
Expand Down Expand Up @@ -102,19 +124,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.modules-build.outputs.cacheHit) }}
uses: docker/setup-qemu-action@v2
with:
platforms: ${{ needs.modules-build.outputs.qemuArch }}

- name: Download Flatpak Deps Artifact
if: ${{ !fromJSON(needs.modules-build.outputs.cacheHit) }}
uses: actions/download-artifact@v3
with:
name: flatpak-builder-deps
name: flatpak-builder-deps-${{ inputs.arch }}

- name: Extract Flatpak Deps Artifact
if: ${{ !fromJSON(needs.modules-build.outputs.cacheHit) }}
run: tar -xvf flatpak-builder-deps.tar
run: tar -xvf flatpak-builder-deps-${{ inputs.arch }}.tar

- name: Build Flatpak Manifest 🧾
uses: flatpak/flatpak-github-actions/flatpak-builder@1283416d7c0462e052ab0685d9444a7a48bfff3b
with:
arch: ${{ inputs.arch }}
build-bundle: ${{ fromJSON(inputs.build-bundle) }}
bundle: input.bundle
manifest-path: ${{ github.workspace }}/build-aux/com.obsproject.Studio.json
Expand All @@ -136,4 +171,4 @@ jobs:
uses: geekyeggo/delete-artifact@v2
with:
useGlob: false
name: flatpak-builder-deps
name: flatpak-builder-deps-${{ inputs.arch }}

0 comments on commit 1f3a1fa

Please sign in to comment.