Skip to content

Commit

Permalink
setup-go cache path, remove go in base image, gomobile
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter committed Mar 31, 2024
1 parent b1dba67 commit 3007a2b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: rdk/go.sum
- name: gomobile
run: |
# todo: pin version in go.mod
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
- name: build AAR
working-directory: rdk
run: |
which go
CGO_CFLAGS="-I $HOME/tensorflow/tensorflow-2.12.0" PLATFORM_NDK_ROOT=$NDK_ROOT NDK_ROOT=$NDK_ROOT make droid-rdk.aar
run: CGO_CFLAGS="-I $HOME/tensorflow/tensorflow-2.12.0" PLATFORM_NDK_ROOT=$NDK_ROOT NDK_ROOT=$NDK_ROOT make droid-rdk.aar
# todo: pass down APK + RDK version information
- name: build APK
working-directory: rdk-apk
Expand All @@ -47,7 +51,12 @@ jobs:
source $SDKMAN_DIR/bin/sdkman-init.sh
# todo(review): is it safe to use gradle in path instead of gradlew? or way to make gradlew use system gradle?
gradle --no-daemon assembleDebug
- name: rename
run: |
mkdir dist
mv rdk-apk/app/build/outputs/apk/debug/app-debug.apk \
dist/rdk-$(date +%y%m%d)-$(cd rdk && git rev-parse --short HEAD)-$(cd rdk-apk && git rev-parse --short HEAD).apk
- uses: actions/upload-artifact@v4
with:
path: rdk-apk/app/build/outputs/apk/debug/app-debug.apk
path: dist
if-no-files-found: error
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ FROM ubuntu:latest
RUN --mount=type=cache,target=/var/cache/apt apt-get update
# make...python3 for tflite build
# nasm for x264
# golang for rdk
RUN --mount=type=cache,target=/var/cache/apt apt-get install -qy \
zip \
openjdk-21-jdk-headless \
make curl patch cmake git python3 \
nasm \
golang-1.21-go
nasm

ENV ANDROID_HOME /droid
ENV ANDROID_SDK_ROOT /droid
Expand All @@ -32,9 +30,6 @@ RUN yes | sdkmanager --sdk_root=$(realpath .) --install "platforms;android-28" "
&& rm -rf tools/lib/monitor* \
&& rm -rf ${NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/musl

ENV PATH ${PATH}:/usr/lib/go-1.21/bin:/root/go/bin
RUN go install golang.org/x/mobile/cmd/gomobile@latest && gomobile init

ENV SDKMAN_DIR /usr/local/sdkman
# this is the sdk manager script from https://get.sdkman.io/
# we have a copy checked-in to get a consistent version
Expand Down

0 comments on commit 3007a2b

Please sign in to comment.