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