chore: Build lib native on a separate amd64 runner #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "New Flatpak" | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| jobs: | ||
| # This step can be skipped once the Kotlin Native compiler | ||
| # gains an ability to be run on a Linux ARM64 host: | ||
| # https://kotlinlang.org/docs/native-target-support.html#hosts | ||
| # | ||
| # After that is done you should be able to just run | ||
| # ./gradlew :desktopApp:packageDistributable | ||
| build-linux-lib-native: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: "Checkout" | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| lfs: true | ||
| submodules: recursive | ||
| - uses: ./.github/actions/setup_gradle | ||
| - name: "Build" | ||
| run: ./gradlew :desktopLibNative:linkReleaseSharedLinuxX64 :desktopLibNative:linkReleaseSharedLinuxArm64 | ||
| - name: 'Upload .so (x86_64)' | ||
| uses: actions/upload-artifact@v6 | ||
| id: upload-artifact | ||
| with: | ||
| name: app-linux-lib-native-x86_64 | ||
| path: | | ||
| desktopLibNative/build/bin/linuxX64/releaseShared/libkeyguard.so | ||
| - name: 'Upload .so (aarch64)' | ||
| uses: actions/upload-artifact@v6 | ||
| id: upload-artifact | ||
| with: | ||
| name: app-linux-lib-native-aarch64 | ||
| path: | | ||
| desktopLibNative/build/bin/linuxArm64/releaseShared/libkeyguard.so | ||
| build-linux-app: | ||
| runs-on: ${{ matrix.runner }} | ||
| needs: | ||
| - build-linux-lib-native | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - runner: ubuntu-latest | ||
| arch: x86_64 | ||
| - runner: ubuntu-24.04-arm | ||
| arch: aarch64 | ||
| steps: | ||
| - name: "Checkout" | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| lfs: true | ||
| submodules: recursive | ||
| - uses: ./.github/actions/setup_gradle | ||
| - name: "Download lib native" | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: app-linux-lib-native-${{ matrix.arch }} | ||
| path: libnative-${{ matrix.arch }} | ||
| - name: "Verify directory structure" | ||
| run: | | ||
| find libnative-${{ matrix.arch }} | ||
| - name: "Move binaries into the libnative directory" | ||
| run: | | ||
| install -D libnative-${{ matrix.arch }}/libkeyguard.so desktopLibNative/build/bin/universal/libkeyguard | ||
| - uses: ./.github/actions/build_desktop_licenses | ||
| - name: "Build" | ||
| run: ./gradlew :desktopApp:packageDistributable -x :desktopLibNative:linkReleaseSharedUniversal | ||
| - name: 'Upload .tar' | ||
| uses: actions/upload-artifact@v6 | ||
| id: upload-artifact | ||
| with: | ||
| name: app-linux-${{ matrix.arch }} | ||
| path: | | ||
| desktopApp/build/distributions/*.tar.gz | ||
| flatpak: | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - build-linux-app | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - name: "Checkout" | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| lfs: true | ||
| submodules: recursive | ||
| - name: "Download artifacts (x86_64)" | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: app-linux-x86_64 | ||
| path: artifacts-x86_64 | ||
| - name: "Download artifacts (aarch64)" | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: app-linux-aarch64 | ||
| path: artifacts-aarch64 | ||
| - name: "Verify directory structure" | ||
| run: | | ||
| find artifacts-x86_64 | ||
| find artifacts-aarch64 | ||
| - name: "Move binaries into the template directory" | ||
| run: | | ||
| mkdir -p desktopApp/flatpak/app-x86_64/ | ||
| mkdir -p desktopApp/flatpak/app-aarch64/ | ||
| tar -xvzf $(find . -type f -regex '\./artifacts-x86_64/.*\.tar.gz') -C desktopApp/flatpak/app-x86_64/ --strip-components=1 | ||
| tar -xvzf $(find . -type f -regex '\./artifacts-aarch64/.*\.tar.gz') -C desktopApp/flatpak/app-aarch64/ --strip-components=1 | ||
| - name: "Verify directory structure" | ||
| run: | | ||
| find desktopApp/flatpak | ||
| - name: "Get Flatpak runtime version -install dependencies" | ||
| run: pip install -r .github/get_flatpak_runtime_version.requirements.txt | ||
| - name: "Get Flatpak runtime version" | ||
| id: get-flatpak-runtime-version | ||
| run: echo "version=$(python .github/get_flatpak_runtime_version.py desktopApp/flatpak/com.artemchep.keyguard.yml)" >> $GITHUB_OUTPUT | ||
| - name: "Setup Flatpak" | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt install flatpak flatpak-builder | ||
| flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo | ||
| flatpak install flathub org.gnome.Platform//${{ steps.get-flatpak-runtime-version.outputs.version }} org.gnome.Sdk//${{ steps.get-flatpak-runtime-version.outputs.version }} -y | ||
| - name: "Build" | ||
| working-directory: desktopApp/flatpak/ | ||
| run: | | ||
| flatpak-builder --force-clean --state-dir=build/flatpak-builder --repo=build/flatpak-repo build/flatpak-target com.artemchep.keyguard.yml | ||
| flatpak build-bundle build/flatpak-repo Keyguard.flatpak com.artemchep.keyguard.yml | ||
| - name: 'Upload .flatpak' | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: app-flatpak | ||
| path: | | ||
| desktopApp/flatpak/**/*.flatpak | ||