From 8d79f100f73af40e112f0962d6f7ae24ca9bf5a0 Mon Sep 17 00:00:00 2001 From: Dustin Lam Date: Wed, 26 Jan 2022 17:27:32 -0800 Subject: [PATCH] Use exact version of NDK needed by presubmit in Github Actions It is required to install ninja manually due to it not being included in the virtual env provided by Github Actions runner. See https://github.com/actions/virtual-environments/issues/741 Fixes: 216535050 Test: Github CI Change-Id: I1a741b1765822f0004adc3985b7babc8022046a5 --- .github/workflows/presubmit.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 1b9652b59464f..45f6ec539f56f 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -164,12 +164,31 @@ 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 + sudo apt-get install ninja-build + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install ninja + elif [ "$RUNNER_OS" == "Windows" ]; then + choco install ninja + else + echo "Failed to install ninja due to unsupport OS: $RUNNER_OS" + exit 1 + fi + cmake --version + which cmake - name: "Set environment variables" shell: bash run: | set -x echo "DIST_DIR=$HOME/dist" >> $GITHUB_ENV + # Make ninja visible to CMAKE + echo "CMAKE_MAKE_PROGRAM=$(which ninja)" >> $GITHUB_ENV + echo "ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/23.1.7779620" >> $GITHUB_ENV # gradle action loads the dependencies cache only on the first run based on arguments. # to control it, we explicitly invoke it once which makes it load the dependencies cache with the parameters # we control @@ -218,7 +237,7 @@ jobs: JAVA_HOME: ${{ steps.setup-java.outputs.path }} JAVA_TOOLS_JAR: ${{ steps.setup-tools-jar.outputs.toolsJar }} with: - arguments: buildOnServer zipTestConfigsWithApks test ${{ needs.setup.outputs.gradlew_flags }} + arguments: buildOnServer zipTestConfigsWithApks test ${{ needs.setup.outputs.gradlew_flags }} -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja build-root-directory: ${{ env.project-root }} configuration-cache-enabled: false dependencies-cache-enabled: false