From ab4a662013d63ed3d9b106d4d584f658c4922a06 Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Fri, 30 Oct 2026 02:46:16 +0100 Subject: [PATCH] ci(cpp): introduce caching cmake and build + format optimization --- .gitea/workflows/cpp.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/cpp.yml b/.gitea/workflows/cpp.yml index cca38ae..f990c90 100644 --- a/.gitea/workflows/cpp.yml +++ b/.gitea/workflows/cpp.yml @@ -17,8 +17,7 @@ jobs: run: | find . \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \ -not -path './build/*' \ - -exec clang-format -i --style=file {} + - git diff --exit-code && echo "clang-format: passed" + -exec clang-format --dry-run -Werror --style=file {} + build & lint: runs-on: alpine @@ -30,11 +29,29 @@ jobs: with: fetch-depth: 0 + - name: Cache CMake build + uses: actions/cache@v4 + with: + path: build + key: cpp-build-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt') }} + restore-keys: | + cpp-build- + + - name: Cache ccache + uses: actions/cache@v4 + with: + path: ~/.ccache + key: ccache-${{ runner.os }}-${{ github.sha }} + restore-keys: | + ccache-${{ runner.os }}- + - name: Configure run: cmake -B build -G Ninja -DENABLE_MODULES=plugin -DCMAKE_BUILD_TYPE=Release - name: Build run: ninja -C build + env: + CMAKE_CXX_COMPILER_LAUNCHER: ccache - name: clang-tidy run: |