Skip to content

No public description #871

No public description

No public description #871

Workflow file for this run

name: "android"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-android:
name: Build (Android)
runs-on: ubuntu-latest
env:
BAZEL: bazelisk-linux-amd64
USE_BAZEL_VERSION: 6.4.0
CC: gcc-10
CXX: g++-10
NDK_API_LEVEL: 21
NDK_VERSION: 21.4.7075529
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- name: Free up some space in an image
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
df -h
- name: Mount bazel cache
uses: actions/cache@v3
with:
# See https://docs.bazel.build/versions/master/output_directories.html
path: "~/.cache/bazel"
key: ${{ runner.os }}-android-bazel-${{ hashFiles('WORKSPACE.bazel') }}
restore-keys: ${{ runner.os }}-android-bazel
- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/latest/download/${BAZEL}"
chmod +x ${BAZEL}
- name: Prepare Android NDK directory for caching
id: ndk-cache-prepare
# Workaround for https://github.com/actions/virtual-environments/issues/1337.
# See also: https://stackoverflow.com/questions/60776512/how-can-i-cache-android-ndk-in-my-github-actions-workflow.
# ANDROID_HOME points to /usr/local/lib/android/sdk.
run: |
echo "===> Android HOME directory: ${ANDROID_HOME}"
sudo mkdir -p ${ANDROID_HOME}/ndk
sudo chmod -R 777 ${ANDROID_HOME}/ndk
sudo chown -R $USER:$USER ${ANDROID_HOME}/ndk
# Push the Android SDK base directory into env variables.
echo "ANDROID_HOME=${ANDROID_HOME}" >> ${GITHUB_ENV}
- name: Android NDK Cache
id: ndk-cache
uses: actions/cache@v3
with:
path: ${{ env.ANDROID_HOME }}/ndk
key: ndk-cache-${{ env.NDK_VERSION }}-v2
- name: Install Android NDK
if: steps.ndk-cache.outputs.cache-hit != 'true'
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;${NDK_VERSION}"
echo "===> Android NDK installed in: "$(ls -l ${ANDROID_HOME}/ndk)
- name: Build
# Since we're simply cross-compiling here, not running any tests because
# there are no Android targets, tests are not included. Just quickly check
# that the client/server architecture builds.
run: ./${BAZEL} build -c opt --config=android_arm64 --action_env=ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/${NDK_VERSION} --action_env=ANDROID_NDK_API_LEVEL=${NDK_API_LEVEL} //mozolm/grpc:client_helper //mozolm/grpc:server_helper