diff --git a/.github/workflows/aarch64.yml b/.github/workflows/aarch64.yml new file mode 100644 index 00000000..4a323c95 --- /dev/null +++ b/.github/workflows/aarch64.yml @@ -0,0 +1,61 @@ +name: New aarch64 Release +run-name: Release v${{ github.event.inputs.tag }} +on: + workflow_dispatch: + inputs: + tag: + description: "Tag" + required: true + default: "1.x.x" +jobs: + build: + runs-on: [ubuntu-20.04] + name: Building aarch64 binary + steps: + - name: Checking out buildscript + uses: actions/checkout@v4 + with: + sparse-checkout: | + aarch64_buildscript + sparse-checkout-cone-mode: false + - name: Installing Packages + run: | + sudo apt -qq update -y > /dev/null + sudo apt -y -qq install binfmt-support qemu-user-static systemd-container wget > /dev/null + - name: Starting Services + run: | + sudo systemctl restart systemd-binfmt + sudo systemctl start systemd-resolved + - name: Downloading Arch Linux Arm Tarball for rpi4 aarch64 + run: | + wget -q http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz + - name: Extracting Tarball + run: | + mkdir root + sudo tar xpf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C root --warning=no-unknown-keyword + - name: Building Swingmusic in qemu + run: | + chmod +x aarch64_buildscript + sed -i -e 's/TAG/${{ github.event.inputs.tag }}/g' aarch64_buildscript + mv aarch64_buildscript root/ + sudo systemd-nspawn --bind-ro=/etc/resolv.conf -D root ./aarch64_buildscript + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.run_number }} + release_name: Release ${{ github.run_number }} + draft: false + prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./root/swingmusicbuilder/swingmusic/dist/swingmusic + asset_name: swingmusic + asset_content_type: application/octet-stream diff --git a/aarch64_buildscript b/aarch64_buildscript new file mode 100755 index 00000000..3796b9d0 --- /dev/null +++ b/aarch64_buildscript @@ -0,0 +1,45 @@ +#!/bin/sh + +# README +# Builds swingmusic binary for aarch64 aka ARM64 architecture +# Run +# ./buildswingmusic.sh +# chmod a+x swingmusicbuilder/swingmusic/dist/swingmusic +# .swingmusicbuilder/swingmusic/dist/swingmusic --port --host +# Notes +# Poetry installer and pipx install poetry are both broken on ARM64 Raspberry Pi OS +# Moving or renaming venv directory (comment inline below) will break that venv. +# Additional poetry bug ongoing https://github.com/python-poetry/poetry/issues/5250 (comment inline below) +# Changed to bash shebang above from repo build script setting of zsh +pacman-key --init > /dev/null +pacman-key --populate archlinuxarm > /dev/null +pacman -Syq --noconfirm > /dev/null +pacman -Sq yarn git wget glibc gcc bzip2 expat gdbm libffi libnsl libxcrypt openssl zlib libnghttp2 icu --noconfirm --disable-download-timeout --needed > /dev/null +wget -q https://github.com/jensgrunzer1/pyhon311-for-aarch64/raw/refs/heads/main/python311-3.11.9-2-aarch64.pkg.tar.xz +pacman -U python311-3.11.9-2-aarch64.pkg.tar.xz --noconfirm +mkdir swingmusicbuilder +cd swingmusicbuilder + +git clone --quiet https://github.com/swing-opensource/swingmusic-client.git +git clone --quiet https://github.com/swing-opensource/swingmusic.git +# Manual poetry installation as installers are broken. +python3.11 -m venv poetry +source poetry/bin/activate + +cd swingmusic + +pip install -U pip setuptools +pip install poetry + +cd ../swingmusic-client +yarn install +yarn build --outDir ../swingmusic/client + +cd ../swingmusic +# Fixes poetry issue 5250. +export PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring +poetry env use /usr/bin/python3.11 +poetry install +# Swing gives error if this is not set. Set to version of repo you cloned. +export SWINGMUSIC_APP_VERSION="TAG" +poetry run python manage.py --build