From df090ac8e88f0d71cddece219bc0de9a051b9e75 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Fri, 11 Mar 2022 10:24:39 +0000 Subject: [PATCH] CI: Cache CMake build --- .github/workflows/cmake.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index faa9b161..4f6af635 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -18,7 +18,7 @@ jobs: name: Linux cache-key: linux cmake-args: '-DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DPICO_SDK_POST_LIST_DIRS=$GITHUB_WORKSPACE/pico-extras' - apt-packages: clang-tidy gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib + apt-packages: ccache gcc-arm-none-eabi runs-on: ${{matrix.os}} @@ -26,6 +26,15 @@ jobs: PICO_SDK_PATH: $GITHUB_WORKSPACE/pico-sdk steps: + - name: Compiler Cache + uses: actions/cache@v2 + with: + path: /home/runner/.ccache + key: ccache-cmake-${{github.ref}}-${{github.sha}} + restore-keys: | + ccache-cmake-${{github.ref}} + ccache-cmake + - uses: actions/checkout@v2 with: submodules: true @@ -44,7 +53,7 @@ jobs: with: repository: raspberrypi/pico-extras path: pico-extras - submodules: false # lwip breaks audio submodule fetchin + submodules: false # lwip breaks audio submodule fetching # Linux deps - name: Install deps @@ -58,10 +67,12 @@ jobs: - name: Configure CMake shell: bash working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE ${{matrix.cmake-args}} + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ${{matrix.cmake-args}} - name: Build working-directory: ${{runner.workspace}}/build shell: bash run: | + ccache --zero-stats || true cmake --build . --config $BUILD_TYPE -j 2 + ccache --show-stats || true