Skip to content

Commit 6e304a8

Browse files
committed
fixup! Improve CI caching
1 parent fefb25c commit 6e304a8

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

.github/workflows/c-cpp.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ jobs:
3939
with:
4040
submodules: true
4141

42+
- name: Get submodule commit hashes
43+
id: get-submodule-commit-hashes
44+
run: git submodule foreach --recursive git rev-parse HEAD > submodule-hashes.txt
45+
4246
- name: Generate cache key
4347
id: gen-cache-key
4448
shell: bash
4549
run: |
46-
git submodule foreach --recursive git rev-parse HEAD > submodule_hashes.txt
47-
echo "cache-key=${{ matrix.os }}-$(sha256sum submodule_hashes.txt)-${{ hashFiles('CMakeLists.txt') }}" >> $GITHUB_OUTPUT
48-
rm submodule_hashes.txt
50+
echo "cache-key=${{ matrix.os }}-${{ hashFiles('submodule-hashes.txt') }}-${{ hashFiles('CMakeLists.txt') }}" >> $GITHUB_OUTPUT
4951
5052
- name: Set up CPM cache
5153
id: setup-cpm-cache
@@ -68,11 +70,11 @@ jobs:
6870
shell: cmd
6971
run: |
7072
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
71-
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" -G Ninja \
72-
-DCPM_SOURCE_CACHE=%USERPROFILE%\cpm-cache \
73-
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
74-
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
75-
-DSLIMEVR_BUILD_TESTS=ON \
73+
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" -G Ninja ^
74+
-DCPM_SOURCE_CACHE=%USERPROFILE%\cpm-cache ^
75+
-DCMAKE_C_COMPILER_LAUNCHER=ccache ^
76+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache ^
77+
-DSLIMEVR_BUILD_TESTS=ON ^
7678
-DCMAKE_BUILD_TYPE=Release
7779
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --config Release -j6
7880

0 commit comments

Comments
 (0)