From 1a4a4b49b4545c9f3ccd864cb2f3b2908efe90cb Mon Sep 17 00:00:00 2001 From: Mason Tran Date: Tue, 28 May 2024 14:47:57 -0400 Subject: [PATCH] [script] add `ccache` to build script to speed up builds when possible --- .github/workflows/build.yml | 11 +++++++++++ script/bootstrap | 2 ++ script/build | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5a428645..4222ed7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,6 +63,14 @@ jobs: with: submodules: true + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ matrix.gcc_ver }} + + - name: Zero ccache stats + run: ccache -z + - name: Create LFS file hash list run: git -C third_party/silabs/gecko_sdk lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id @@ -85,6 +93,9 @@ jobs: export PATH=${HOME}/.local/${{ matrix.gcc_extract_dir }}/bin:$PATH script/test + - name: Print ccache stats + run: ccache -s + - name: Gather SLC generated files if: failure() run: | diff --git a/script/bootstrap b/script/bootstrap index e2694c2c..9b64de4a 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -48,6 +48,7 @@ install_packages_apt() # Install dependencies sudo apt-get update apt_packages=( + ccache coreutils git git-lfs @@ -77,6 +78,7 @@ install_packages_brew() echo 'Installing script dependencies...' brew_packages=( + ccache coreutils git git-lfs diff --git a/script/build b/script/build index 7793bc41..488f225d 100755 --- a/script/build +++ b/script/build @@ -220,7 +220,9 @@ build_soc() -DOT_APP_RCP=OFF \ -DOT_COMPILE_WARNING_AS_ERROR=ON \ "$@" "${repo_dir}" \ - --graphviz=graph.dot + --graphviz=graph.dot \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache ninja "${soc_targets[@]}"