From 95b7a64f1c1107f59b820cd3dd747f1f25577799 Mon Sep 17 00:00:00 2001 From: David Chavez Date: Mon, 27 May 2024 12:33:15 +0200 Subject: [PATCH] CI: Build aarch64 linux (#249) --- .github/linux/appimage.sh | 22 ++++++++++++++++++---- .github/workflows/validate.yml | 22 +++++++++++++--------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/.github/linux/appimage.sh b/.github/linux/appimage.sh index e1c23cf..3d706ba 100755 --- a/.github/linux/appimage.sh +++ b/.github/linux/appimage.sh @@ -1,4 +1,18 @@ -curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-static-x86_64.AppImage" +ARCH=$(uname -m) +LINUX_DEPLOY_ARCH=$(uname -m) + +if [ "$ARCH" == "x86_64" ]; then + ARCH="x86_64" + LINUX_DEPLOY_ARCH="x86_64" +elif [ "$ARCH" == "aarch64" ]; then + ARCH="arm_aarch64" + LINUX_DEPLOY_ARCH="aarch64" +else + echo "Unsupported architecture: $ARCH" + exit 1 +fi + +curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$LINUX_DEPLOY_ARCH.AppImage" curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy-plugin-gtk/raw/master/linuxdeploy-plugin-gtk.sh" chmod a+x linuxdeploy* @@ -8,10 +22,10 @@ cp -r assets/ AppDir/usr/bin/ cp icons/512.png AppDir/Zelda64Recompiled.png cp .github/linux/Zelda64Recompiled.desktop AppDir/ -./linuxdeploy-static-x86_64.AppImage --appimage-extract +"./linuxdeploy-$LINUX_DEPLOY_ARCH.AppImage" --appimage-extract mv squashfs-root/ deploy -ARCH=x86_64 ./deploy/AppRun --appdir=AppDir/ -d AppDir/Zelda64Recompiled.desktop -i AppDir/Zelda64Recompiled.png -e AppDir/usr/bin/Zelda64Recompiled --plugin gtk +./deploy/AppRun --appdir=AppDir/ -d AppDir/Zelda64Recompiled.desktop -i AppDir/Zelda64Recompiled.png -e AppDir/usr/bin/Zelda64Recompiled --plugin gtk sed -i 's/exec/#exec/g' AppDir/AppRun echo 'cd "$this_dir"/usr/bin/' >> AppDir/AppRun echo './Zelda64Recompiled' >> AppDir/AppRun -ARCH=x86_64 ./deploy/usr/bin/linuxdeploy-plugin-appimage --appdir=AppDir +./deploy/usr/bin/linuxdeploy-plugin-appimage --appdir=AppDir diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index bd339b0..fbaf051 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -3,7 +3,7 @@ on: push: branches: - dev - pull_request_target: + pull_request: types: [opened, synchronize] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -17,12 +17,15 @@ jobs: runs-on: ubuntu-latest steps: - run: echo ✓ - build-unix: + build-linux: needs: authorize - runs-on: ubuntu-22.04 + runs-on: ${{ matrix.arch == 'x64' && matrix.os || format('blaze/{0}', matrix.os) }} strategy: matrix: type: [ Debug, Release ] + os: [ ubuntu-22.04 ] + arch: [ x64, arm64 ] + name: ${{ matrix.os }} (${{ matrix.arch }}, ${{ matrix.type }}) steps: - name: Checkout uses: actions/checkout@v4 @@ -32,7 +35,7 @@ jobs: - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: - key: ${{ runner.os }}-z64re-ccache-${{ matrix.type }} + key: ${{ matrix.os }}-z64re-ccache-${{ matrix.type }} - name: Install Linux Dependencies if: runner.os == 'Linux' run: | @@ -90,25 +93,26 @@ jobs: run: | mv cmake-build/Zelda64Recompiled Zelda64Recompiled rm -rf assets/scss - tar -czf Zelda64Recompiled-${{ runner.os }}-${{ matrix.type }}.tar.gz Zelda64Recompiled assets/ + tar -czf Zelda64Recompiled.tar.gz Zelda64Recompiled assets/ - name: Archive Zelda64Recomp uses: actions/upload-artifact@v4 with: - name: Zelda64Recompiled-${{ runner.os }}-${{ matrix.type }} - path: Zelda64Recompiled-${{ runner.os }}-${{ matrix.type }}.tar.gz + name: Zelda64Recompiled-${{ runner.os }}-${{ runner.arch }}-${{ matrix.type }} + path: Zelda64Recompiled.tar.gz - name: Prepare AppImage run: ./.github/linux/appimage.sh - name: Zelda64Recomp AppImage uses: actions/upload-artifact@v4 with: - name: Zelda64Recompiled-AppImage-${{ matrix.type }} - path: Zelda64Recompiled-x86_64.AppImage + name: Zelda64Recompiled-AppImage-${{ runner.arch }}-${{ matrix.type }} + path: Zelda64Recompiled-*.AppImage build-windows: needs: authorize runs-on: windows-latest strategy: matrix: type: [ Debug, Release ] + name: windows (${{ matrix.type }}) steps: - name: Checkout uses: actions/checkout@v4