diff --git a/.github/workflows/build-for-arm64.yml b/.github/workflows/build-for-arm64.yml index 2064edc..c0e864a 100644 --- a/.github/workflows/build-for-arm64.yml +++ b/.github/workflows/build-for-arm64.yml @@ -1,65 +1,82 @@ -name: Build for arm64 +name: Build arm64 wrapper on: + workflow_dispatch: push: - branches: [ "arm64" ] + branches: [arm64] pull_request: - branches: [ "arm64" ] + branches: [arm64] permissions: contents: write +concurrency: + group: wrapper-arm64-${{ github.ref }} + cancel-in-progress: true + jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install build dependencies + run: | + sudo apt-get update + sudo apt-get install -y aria2 cmake ninja-build gcc-aarch64-linux-gnu + + - name: Download Android NDK r23b + run: | + aria2c -o android-ndk-r23b-linux.zip \ + https://dl.google.com/android/repository/android-ndk-r23b-linux.zip + unzip -q android-ndk-r23b-linux.zip + + - name: Build arm64 wrapper + run: | + cmake -S . -B build -G Ninja + cmake --build build - - name: Install aria2 - run: sudo apt install aria2 -y + - name: Verify arm64 binaries + run: | + for binary in wrapper wrapper-rootless wrapper-android rootfs/system/bin/main; do + file "$binary" + file "$binary" | grep -qE 'ARM aarch64|ARM64|aarch64' + done - - name: Install LLVM - run: sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" + - name: Set artifact metadata + id: vars + run: echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" - - name: Install cross complier - run: sudo apt install gcc-aarch64-linux-gnu -y - - - name: Set up Android NDK r23b - run: | - aria2c -o android-ndk-r23b-linux.zip https://dl.google.com/android/repository/android-ndk-r23b-linux.zip - unzip -q -d . android-ndk-r23b-linux.zip - - - name: Build - run: | - mkdir build - cd build - cmake .. - make + - name: Package arm64 wrapper + run: | + zip -r Wrapper.arm64.latest.zip \ + rootfs/ android/ wrapper wrapper-rootless wrapper-android \ + Dockerfile compose.yaml entrypoint.sh - - name: Set outputs - id: vars - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + - name: Upload arm64 artifact + uses: actions/upload-artifact@v4 + with: + name: Wrapper.arm64.${{ steps.vars.outputs.sha_short }} + path: Wrapper.arm64.latest.zip + if-no-files-found: error - - name: Create Release Zip File - run: zip -r Wrapper.arm64.latest.zip rootfs/ android/ wrapper wrapper-rootless wrapper-android compose.yaml entrypoint.sh Dockerfile - - - name: Update Tag - run: | - git tag -f wrapper.arm64.latest - git push origin wrapper.arm64.latest --force + - name: Move latest arm64 tag + if: github.event_name == 'push' && github.ref == 'refs/heads/arm64' + run: | + git tag -f wrapper.arm64.latest + git push origin wrapper.arm64.latest --force - - name: Create or Update Release - uses: softprops/action-gh-release@v2 - with: - files: Wrapper.arm64.latest.zip - body: | - Latest arm64 build. - Commit: ${{ github.sha }} - Message: ${{ github.event.head_commit.message }} - name: Wrapper.arm64.latest - tag_name: wrapper.arm64.latest - make_latest: true - overwrite: true \ No newline at end of file + - name: Publish latest arm64 release + if: github.event_name == 'push' && github.ref == 'refs/heads/arm64' + uses: softprops/action-gh-release@v2 + with: + tag_name: wrapper.arm64.latest + name: Wrapper.arm64.latest + body: | + Latest arm64 wrapper build. + Commit: ${{ github.sha }} + files: Wrapper.arm64.latest.zip + make_latest: false