ci(cpp): introduce caching cmake and build + format optimization
This commit is contained in:
@@ -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: |
|
||||
|
||||
Reference in New Issue
Block a user