Skip to content

Commit

Permalink
Use exact version of NDK needed by presubmit in Github Actions
Browse files Browse the repository at this point in the history
It is required to install ninja manually due to it not being included in
the virtual env provided by Github Actions runner.

See actions/runner-images#741

In order for Ninja to be visible to CMake during NDK builds, it must be
installed in the same subdirectory, so for now it is symlinked on Linux
builds. See b/206099937

Fixes: 216535050
Test: Github CI
Change-Id: I1a741b1765822f0004adc3985b7babc8022046a5
  • Loading branch information
dlam committed Jan 28, 2022
1 parent 7f857d7 commit d4467d1
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,35 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: "11"
# Required for CMake when building workmanager.
- name: "Install Ninja"
run: |
set -x
if [ "$RUNNER_OS" == "Linux" ]; then
# Should use version 1.10.2 but it is not available on apt yet.
sudo apt-get install ninja-build=1.10.0-1build1
elif [ "$RUNNER_OS" == "macOS" ]; then
# Shoudl use version 1.10.2, but it is not well supported by Homebrew.
brew install ninja
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install ninja --version=1.10.2
else
echo "Failed to install ninja due to unsupport OS: $RUNNER_OS"
exit 1
fi
# See b/206099937. Hack needed to make ninja visible to cmake during NDK builds
if [ ! -e "/usr/local/bin/ninja" ]; then
ln -s "/usr/bin/ninja" "/usr/local/bin/ninja"
fi
- name: "Set environment variables"
shell: bash
run: |
set -x
echo "DIST_DIR=$HOME/dist" >> $GITHUB_ENV
# use latest NDK because the default NDK on github is older.
# TODO b/216535050: Implement task to install the exact AndroidX ndk version.
echo "ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV
# TODO b/216535050: Implement task to install the exact AndroidX ndk
# version in case it is not available.
echo "ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/23.1.7779620" >> $GITHUB_ENV
- name: "Setup Gradle"
uses: gradle/gradle-build-action@v2
Expand Down

0 comments on commit d4467d1

Please sign in to comment.