Skip to content

Commit 96a3111

Browse files
authored
Create build.yml
1 parent 223a92d commit 96a3111

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: build-kopia-android
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: self-hosted
9+
env:
10+
ANDROID_NDK_ZIP: android-ndk-r28c-linux.zip
11+
ANDROID_NDK_DIR: android-ndk-r28c
12+
# go install will put the binary here
13+
GOBIN: ${{ github.workspace }}/out
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.22.x'
22+
23+
- name: Get Android NDK
24+
run: |
25+
wget https://dl.google.com/android/repository/${ANDROID_NDK_ZIP}
26+
unzip -q ${ANDROID_NDK_ZIP}
27+
28+
- name: Build Kopia (Android/arm64, CGO, netcgo)
29+
run: |
30+
export ANDROID_NDK="${PWD}/${ANDROID_NDK_DIR}"
31+
export CC="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
32+
export CXX="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
33+
export GOOS=android GOARCH=arm64 CGO_ENABLED=1
34+
mkdir -p "$GOBIN"
35+
# netcgo ensures the cgo DNS resolver is used
36+
go install -tags netcgo github.com/kopia/kopia@v0.21.1
37+
ls -l "$GOBIN"
38+
39+
- name: Upload Android binary
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: kopia-android-arm64
43+
path: out/kopia

0 commit comments

Comments
 (0)