File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Unit Test (Android NDK)
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches :
7+ - unit-test
8+
9+ jobs :
10+ test-android-build :
11+ name : Build Android (${{ matrix.arch }})
12+ runs-on : ubuntu-latest
13+ strategy :
14+ fail-fast : false
15+ matrix :
16+ include :
17+ - arch : android-aarch64
18+ goarch : arm64
19+ - arch : android-x86_64
20+ goarch : amd64
21+ - arch : android-armv7
22+ goarch : arm
23+ goarm : " 7"
24+
25+ steps :
26+ - uses : actions/checkout@v4
27+
28+ - name : Set up Go
29+ uses : actions/setup-go@v5
30+ with :
31+ go-version : ' 1.25'
32+
33+ - name : Install NDK
34+ run : |
35+ NDK_VERSION="25.2.9519653"
36+ cd /tmp
37+ wget -q https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-linux.zip
38+ unzip -q android-ndk-${NDK_VERSION}-linux.zip
39+
40+ ANDROID_NDK_HOME=/tmp/android-ndk-${NDK_VERSION}
41+ TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64
42+
43+ echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV
44+ echo "TOOLCHAIN=$TOOLCHAIN" >> $GITHUB_ENV
45+
46+ if [ "${{ matrix.goarch }}" = "arm64" ]; then
47+ echo "CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang" >> $GITHUB_ENV
48+ elif [ "${{ matrix.goarch }}" = "amd64" ]; then
49+ echo "CC=$TOOLCHAIN/bin/x86_64-linux-android21-clang" >> $GITHUB_ENV
50+ elif [ "${{ matrix.goarch }}" = "arm" ]; then
51+ echo "CC=$TOOLCHAIN/bin/armv7a-linux-androideabi21-clang" >> $GITHUB_ENV
52+ fi
53+
54+ - name : Build Android Binary
55+ env :
56+ GOOS : android
57+ GOARCH : ${{ matrix.goarch }}
58+ GOARM : ${{ matrix.goarm || '' }}
59+ CGO_ENABLED : 1
60+ run : |
61+ go build -ldflags="-s -w" -o ${{ matrix.arch }} ./cmd/autolinux
62+ file ${{ matrix.arch }}
You can’t perform that action at this time.
0 commit comments