diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a0bb2def..7d9d91d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,6 +72,12 @@ jobs: with: submodules: true + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ matrix.gcc_ver }} + verbose: 2 + - 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 @@ -94,7 +100,14 @@ jobs: run: docker load -i ot-efr32-dev.tar - name: Start ot-efr32-dev container - run: docker run --rm -it --user $(id -u) --name ot-efr32-dev -d -v $PWD:/ot-efr32 -w /ot-efr32 ${{ env.DOCKER_IMAGE_SHA_TAG }} + run: | + docker run \ + --rm -it -d \ + --user $(id -u) \ + --name ot-efr32-dev \ + --env CCACHE_DIR=/ot-efr32/.ccache \ + -v $PWD:/ot-efr32 -w /ot-efr32\ + ${{ env.DOCKER_IMAGE_SHA_TAG }} - name: Bootstrap ARM Toolchain run: docker exec ot-efr32-dev script/bootstrap arm_toolchain ${{ matrix.gcc_download_url }} ${{ matrix.gcc_extract_dir }} ${{ env.TOOLCHAIN_DIR }} diff --git a/script/bootstrap b/script/bootstrap index de6f511c..d75fbd89 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..22a53621 100755 --- a/script/build +++ b/script/build @@ -89,6 +89,12 @@ OT_OPTIONS=( "-DOT_EXTERNAL_HEAP=ON" "-DOT_SLAAC=ON" ) + +# Check if ccache is installed and use it if available +if command -v ccache >/dev/null; then + OT_OPTIONS+=("-DCMAKE_C_COMPILER_LAUNCHER=ccache") + OT_OPTIONS+=("-DCMAKE_CXX_COMPILER_LAUNCHER=ccache") +fi readonly OT_OPTIONS generate() diff --git a/script/build_example_apps b/script/build_example_apps index 21c0ed44..7a1e15b6 100755 --- a/script/build_example_apps +++ b/script/build_example_apps @@ -59,6 +59,12 @@ OT_OPTIONS=( "-DOT_PING_SENDER=ON" "-DOT_SLAAC=ON" ) + +# Check if ccache is installed and use it if available +if command -v ccache >/dev/null; then + OT_OPTIONS+=("-DCMAKE_C_COMPILER_LAUNCHER=ccache") + OT_OPTIONS+=("-DCMAKE_CXX_COMPILER_LAUNCHER=ccache") +fi readonly OT_OPTIONS die()