Skip to content

Commit

Permalink
fix daily job (#12)
Browse files Browse the repository at this point in the history
* remove tflite references

* bump go to 1.23 in base image

* add cron monitoring

* add pkg-config
  • Loading branch information
abe-winter authored Nov 8, 2024
1 parent eed68d9 commit 99f73fb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
runs-on: buildjet-8vcpu-ubuntu-2204
container: ghcr.io/${{ github.repository }}
steps:
- name: sentry begin
run: curl ${{ secrets.SENTRY_CRONS }}?status=in_progress
- uses: actions/checkout@v4
with:
path: rdk-apk
Expand All @@ -29,22 +31,17 @@ jobs:
run: |
mkdir -p ~/.android
[ -n "$DEBUG_KEYSTORE" ] && echo "$DEBUG_KEYSTORE" | base64 > ~/.android/debug.keystore
# todo: put tflite and x264 in same etc/android/prefix, then try pkgconfig
# todo: put x264 in same etc/android/prefix, then try pkgconfig
# todo: look at short-lived cache of etc/android/prefix
- name: build x264
if: hashFiles('rdk/etc/android/build-x264.sh') != ''
working-directory: rdk
run: |
make etc/android/prefix/aarch64
make etc/android/prefix/x86_64
- name: build tflite
working-directory: rdk
# we need tflite headers but not the full build. add SRC_ONLY flag
# if: false
run: ANDROID_NDK=$NDK_ROOT KEEP_TFLITE_SRC=1 etc/android/build-tflite.sh
- name: build AAR
working-directory: rdk
run: CGO_CFLAGS="-I $HOME/tensorflow/tensorflow-2.12.0" PLATFORM_NDK_ROOT=$NDK_ROOT NDK_ROOT=$NDK_ROOT make droid-rdk.aar
run: PLATFORM_NDK_ROOT=$NDK_ROOT NDK_ROOT=$NDK_ROOT make droid-rdk.aar
# todo: pass down APK + RDK version information
- name: build APKs
working-directory: rdk-apk
Expand Down Expand Up @@ -92,6 +89,12 @@ jobs:
glob: rdk-apk-latest.*.apk
destination: packages.viam.com/apps/rdk-apk
parent: false
- name: sentry ok
if: success()
run: curl ${{ secrets.SENTRY_CRONS }}?status=ok
- name: sentry error
if: failure()
run: curl ${{ secrets.SENTRY_CRONS }}?status=error
# todo: get a working token and re-enable this
# - uses: slackapi/slack-github-action@v1
# # todo: switch to slack integration when https://github.com/integrations/slack/issues/1563 is resolved (only report errors)
Expand Down
27 changes: 17 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# base image for APK builds
FROM ubuntu:latest
FROM ubuntu:jammy

RUN --mount=type=cache,target=/var/cache/apt apt-get update
# make...python3 for tflite build
# nasm for x264
RUN --mount=type=cache,target=/var/cache/apt apt-get install -qy \
zip \
openjdk-21-jdk-headless \
make curl patch cmake git python3 \
make curl patch cmake git python3 wget pkg-config \
nasm

ENV ANDROID_HOME /droid
ENV ANDROID_SDK_ROOT /droid
ENV ANDROID_HOME=/droid
ENV ANDROID_SDK_ROOT=/droid

WORKDIR ${ANDROID_SDK_ROOT}

# https://developer.android.com/studio#command-line-tools-only
ARG CLI_TOOLS=commandlinetools-linux-11076708_latest.zip
RUN curl --fail --silent --show-error -o ${CLI_TOOLS} https://dl.google.com/android/repository/${CLI_TOOLS} && unzip -q ${CLI_TOOLS} && rm ${CLI_TOOLS}

ENV PATH ${PATH}:/droid/cmdline-tools/bin
ENV PATH=${PATH}:/droid/cmdline-tools/bin
ARG NDK_VERSION=26.2.11394342
ENV NDK_ROOT ${ANDROID_SDK_ROOT}/ndk/${NDK_VERSION}
ENV NDK_ROOT=${ANDROID_SDK_ROOT}/ndk/${NDK_VERSION}

# note: we target android 28, but compileSdk is 34 in our gradle files; check if both are needed
# we're removing unused tools to shrink the image size
Expand All @@ -30,16 +30,23 @@ 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 SDKMAN_DIR /usr/local/sdkman
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
# todo: look at getting openjdk from here as well
RUN --mount=type=bind,source=etc/get-sdkman.sh,target=get-sdkman.sh ./get-sdkman.sh
# requires bash because it uses 'source' keyword internally
RUN bash -c "source $SDKMAN_DIR/bin/sdkman-init.sh && sdk install gradle 8.2"

# note: actions/setup-go fails at the jni step in a way I don't understand. apt getting for now.
ENV PATH ${PATH}:/usr/lib/go-1.21/bin:/root/go/bin
RUN --mount=type=cache,target=/var/cache/apt apt-get install -qy golang-1.21-go
# note: actions/setup-go fails at the jni step in a way I don't understand. manually installing for now.
ARG GO_VERSION=1.23.2
RUN wget --quiet https://go.dev/dl/go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz \
&& tar xf go*.linux-*.tar.gz -C /usr/local/lib \
&& mv /usr/local/lib/go /usr/local/lib/go-${GO_VERSION} \
&& rm go*.linux-*.tar.gz \
&& update-alternatives --install /usr/bin/go go /usr/local/lib/go-${GO_VERSION}/bin/go 10 \
--slave /usr/bin/gofmt gofmt /usr/local/lib/go-${GO_VERSION}/bin/gofmt

# todo: pin gomobile in rdk tools.go
ENV PATH=${PATH}:/root/go/bin
RUN go install golang.org/x/mobile/cmd/gomobile@latest && gomobile init

0 comments on commit 99f73fb

Please sign in to comment.