From 589f10c7ef522e4ee8f40561e9a9df38588662d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=BA=E7=9B=96=E5=B4=BD?= Date: Sun, 16 Feb 2025 10:54:25 +0800 Subject: [PATCH] ci: add linux arm64 build (#935) --- .github/workflows/build.yml | 43 ++++++++++++++++++++++++++++++++++++- .github/workflows/test.yml | 5 +++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0796b4a3..23fcb4c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -241,7 +241,7 @@ jobs: sudo apt install -y ninja-build libgtk-3-dev libayatana-appindicator3-1 libayatana-appindicator3-dev # appimage build dependencies sudo apt install -y libfuse2 locate - wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" + wget -O appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" chmod +x appimagetool sudo mv appimagetool /usr/local/bin/ - name: Build @@ -262,6 +262,47 @@ jobs: upload_url: ${{ needs.get-release.outputs.upload_url }} asset_path: ui/flutter/dist/*/* overwrite: true + build-linux-arm64: + if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'linux-arm64' }} + runs-on: ubuntu-22.04-arm + needs: [get-release] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + - uses: subosito/flutter-action@v2 + with: + channel: master + flutter-version: ${{ env.FLUTTER_VERSION }} + - name: Install dependencies + run: | + sudo apt update -y + # flutter build dependencies + sudo apt install -y ninja-build libgtk-3-dev libayatana-appindicator3-1 libayatana-appindicator3-dev + # appimage build dependencies + sudo apt install -y libfuse2 locate + wget -O appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage" + chmod +x appimagetool + sudo mv appimagetool /usr/local/bin/ + - name: Build + env: + VERSION: ${{ needs.get-release.outputs.version }} + run: | + go build -tags nosqlite -ldflags="-w -s -X github.com/GopeedLab/gopeed/pkg/base.Version=$VERSION" -buildmode=c-shared -o ui/flutter/linux/bundle/lib/libgopeed.so github.com/GopeedLab/gopeed/bind/desktop + go build -ldflags="-w -s" -o ui/flutter/assets/host/host github.com/GopeedLab/gopeed/cmd/host + cd ui/flutter + dart pub global activate -sgit https://github.com/GopeedLab/flutter_distributor.git --git-path packages/flutter_distributor + flutter_distributor package --platform linux --targets appimage,deb + cd dist/* + mv gopeed-*-linux.AppImage Gopeed-v${VERSION}-linux-aarch64.AppImage + mv gopeed-*-linux.deb Gopeed-v${VERSION}-linux-arm64.deb + - name: Upload + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ needs.get-release.outputs.upload_url }} + asset_path: ui/flutter/dist/*/* + overwrite: true build-snap: if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'snap' }} runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2cf4410d..10ae6974 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,7 +63,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ windows-latest, macos-latest, ubuntu-22.04 ] + os: [ windows-latest, macos-latest, ubuntu-22.04, ubuntu-22.04-arm ] needs: [ test ] steps: - uses: actions/checkout@v3 @@ -73,6 +73,7 @@ jobs: - uses: subosito/flutter-action@v2 with: flutter-version: ${{ env.FLUTTER_VERSION }} + channel: master - if: runner.os == 'Windows' run: | go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/windows/libgopeed.dll github.com/GopeedLab/gopeed/bind/desktop @@ -164,4 +165,4 @@ jobs: cd ../../ rm -rf cmd/web/dist cp -r ui/flutter/build/web cmd/web/dist - docker build -t gopeed . \ No newline at end of file + docker build -t gopeed .