From 439c18d8ebcea45c4fd85ce9de7e4c91eaf8c509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Betto?= Date: Sun, 12 Feb 2023 18:16:46 +0100 Subject: [PATCH] Fix ccache not working in CI The default `compiler_check` strategy used by ccache was causing a 0% hit rate, as it was using the compiler's "modified time" as part of the hash. Since the script installs dependencies from scratch for every run, mtime was always different, causing different hashes even when source files were unchanged. To avoid this, use the NDK version as part of the hash instead. --- .github/workflows/ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 037f5e7c..16f29568 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,8 @@ jobs: JVM_OPTS: -Xmx6G IS_SKYLINE_SIGNED: ${{ secrets.KEYSTORE != '' }} UPLOAD_ARTIFACTS: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci') }} + CMAKE_VERSION: "3.22.1" + NDK_VERSION: "25.0.8775105" steps: - name: Git Checkout @@ -27,7 +29,7 @@ jobs: - name: Restore CCache uses: hendrikmuhs/ccache-action@v1.2 with: - max-size: 2Gi + max-size: 3Gi - name: Restore Gradle Cache uses: actions/cache@v3 @@ -45,7 +47,7 @@ jobs: ln -s /usr/bin/ninja . - name: Install CMake & Android NDK - run: echo "yes" | $ANDROID_HOME/tools/bin/sdkmanager "cmake;3.22.1" "ndk;25.0.8775105" --channel=3 | grep -v = || true + run: echo "yes" | $ANDROID_HOME/tools/bin/sdkmanager "cmake;${{ env.CMAKE_VERSION }}" "ndk;${{ env.NDK_VERSION }}" --channel=3 | grep -v = || true - name: Decode Keystore if: env.IS_SKYLINE_SIGNED == 'true' @@ -61,7 +63,7 @@ jobs: SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} CMAKE_C_COMPILER_LAUNCHER: "ccache" CMAKE_CXX_COMPILER_LAUNCHER: "ccache" - CCACHE_NOCOMPRESS: "true" + CCACHE_COMPILERCHECK: "string:${{ env.NDK_VERSION }}" run: ./gradlew --stacktrace --configuration-cache --build-cache --parallel --configure-on-demand assembleFull - name: Rename APKs (Signed)