From 530ffa0bd8abc555ea4db9825cd8cca17597c78a Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 8 Jun 2024 23:09:43 +0200 Subject: [PATCH] Added linux arm64 --- .github/workflows/build-and-release.yml | 107 ++++++++++++++++++++---- 1 file changed, 91 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index cf51ebb1..1e81f119 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -3,8 +3,8 @@ on: push jobs: - build: - name: Build app + build_main: + name: Build app (Windows [x86, arm64], macOS [arm64, x86], Linux [x86]) strategy: fail-fast: true @@ -15,33 +15,25 @@ jobs: dotnet_runtime: 'osx-arm64' dotnet_name_postfix: '-aarch64-apple-darwin' tauri_bundle: 'dmg' - + - platform: 'macos-latest' # for Intel-based macOS rust_target: 'x86_64-apple-darwin' dotnet_runtime: 'osx-x64' dotnet_name_postfix: '-x86_64-apple-darwin' tauri_bundle: 'dmg' - + - platform: 'ubuntu-22.04' # for x86-based linux rust_target: 'x86_64-unknown-linux-gnu' dotnet_runtime: 'linux-x64' dotnet_name_postfix: '-x86_64-unknown-linux-gnu' tauri_bundle: 'appimage deb' -# -# Issue https://github.com/twistedfall/opencv-rust/issues/457 -# -# - platform: 'ubuntu-22.04' # for ARM-based linux -# rust_target: 'aarch64-unknown-linux-gnu' -# dotnet_runtime: 'linux-arm64' -# dotnet_name_postfix: '-aarch64-unknown-linux-gnu' -# tauri_bundle: 'appimage deb' - + - platform: 'windows-latest' # for x86-based windows rust_target: 'x86_64-pc-windows-msvc' dotnet_runtime: 'win-x64' dotnet_name_postfix: '-x86_64-pc-windows-msvc.exe' tauri_bundle: 'msi nsis' - + - platform: 'windows-latest' # for ARM-based windows rust_target: 'aarch64-pc-windows-msvc' dotnet_runtime: 'win-arm64' @@ -115,8 +107,8 @@ jobs: with: targets: ${{ matrix.rust_target }} - - name: Setup dependencies (Ubuntu-specific) - if: matrix.platform == 'ubuntu-22.04' + - name: Setup dependencies (Ubuntu-specific, x86) + if: matrix.platform == 'ubuntu-22.04' && contains(matrix.rust_target, 'x86_64') run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf @@ -187,4 +179,87 @@ jobs: name: MindWork AI Studio (Linux - AppImage ${{ matrix.dotnet_runtime }}) path: "runtime/target/${{ matrix.rust_target }}/release/bundle/appimage/mind-work-ai-studio_*.AppImage" if-no-files-found: error + retention-days: 1 + + build_linux_arm64: + name: Build app (Linux [arm64]) + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true # Enable Git LFS + + - uses: pguyot/arm-runner-action@v2.6.5 + with: + base_image: dietpi:rpi_armv8_bullseye + cpu: cortex-a53 + image_additional_mb: 5000 # ~ 5GB + optimize_image: false + commands: | + # Rust complains (rightly) that $HOME doesn't match eid home: + export HOME=/root + + # Workaround to CI worker being stuck on Updating crates.io index: + export CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse + + # Update and upgrade the system: + apt-get update --yes --allow-releaseinfo-change + apt-get upgrade --yes + apt-get autoremove --yes + apt-get install curl wget apt-transport-https --yes + export DEBIAN_FRONTEND=noninteractive + export TZ=Europe/Berlin + + # + # Install .NET SDK: + # + # Note: We cannot use the official Microsoft package because it's not available for ARM64. + # + + # Install the dependencies: + apt-get install --yes --no-install-recommends ca-certificates libc6 libgcc-s1 libgssapi-krb5-2 libicu69 libssl1.1 libstdc++6 zlib1g + + # Download and install the .NET SDK: +# wget --no-verbose https://download.visualstudio.microsoft.com/download/pr/cd9decc0-f3ef-46d6-b7d1-348b757781ad/9ad92a8f4b805feb3d017731e78eca15/dotnet-sdk-8.0.301-linux-arm64.tar.gz -O dotnet-sdk.tar.gz +# mkdir -p /usr/share/dotnet +# tar -zxf dotnet-sdk.tar.gz -C /usr/share/dotnet + wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh + chmod +x ./dotnet-install.sh + ./dotnet-install.sh --channel 8.0 + export DOTNET_ROOT=$HOME/.dotnet + export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools + export DOTNET_CLI_TELEMETRY_OPTOUT=true + + # Compile the app: + cd "app/MindWork AI Studio" + dotnet publish --configuration release --runtime linux-arm --disable-build-servers --force --output ../../publish/dotnet + + # Move & rename the .NET artifact: + cd ../.. + mkdir -p "app/MindWork AI Studio/bin/dist" + cd publish/dotnet + mv mindworkAIStudio "../../app/MindWork AI Studio/bin/dist/mindworkAIStudio-aarch64-unknown-linux-gnu" + + # Install Rust: + cd ../.. + curl https://sh.rustup.rs -sSf | sh -s -- --yes + . "$HOME/.cargo/env" + + # Install build tools and tauri-cli requirements: + apt-get install --yes libwebkit2gtk-4.0-dev build-essential libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev + + # Setup Tauri: + cargo install tauri-cli + + # Build the runtime: + cd runtime + cargo tauri build --target aarch64-unknown-linux-gnu --bundles deb + + - name: Upload artifact (Linux - Debian Package) + uses: actions/upload-artifact@v4 + with: + name: MindWork AI Studio (Linux - deb linux-arm) + path: "${{ github.workspace }}/runtime/target/aarch64-unknown-linux-gnu/release/bundle/deb/mind-work-ai-studio_*.deb" + if-no-files-found: error retention-days: 1 \ No newline at end of file