Skip to content

Commit d449a05

Browse files
committed
use ccache for MSBuild builds
1 parent ca03ad9 commit d449a05

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

.github/workflows/CI-windows.yml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,16 @@ jobs:
8383
env:
8484
# see https://www.pcre.org/original/changelog.txt
8585
PCRE_VERSION: 8.45
86+
CCACHE_VERSION: 4.7.4
8687

8788
steps:
8889
- uses: actions/checkout@v3
8990

91+
- name: ccache
92+
uses: hendrikmuhs/ccache-action@v1.2
93+
with:
94+
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.arch }}
95+
9096
- name: Set up Python 3.11
9197
uses: actions/setup-python@v4
9298
with:
@@ -98,6 +104,32 @@ jobs:
98104
with:
99105
arch: ${{ matrix.arch }}
100106

107+
- name: Cache ccache
108+
id: cache-ccache
109+
uses: actions/cache@v3
110+
with:
111+
path: |
112+
ccache\cl.exe
113+
key: pcre-${{ env.CCACHE_VERSION }}-${{ matrix.arch }}-bin-win
114+
115+
- name: Download ccache
116+
if: steps.cache-ccache.outputs.cache-hit != 'true'
117+
run: |
118+
if "${{ matrix.arch }}" == "x86" (
119+
set ARCH=i686
120+
) else (
121+
set ARCH=x86_64
122+
)
123+
curl -fsSL https://github.com/ccache/ccache/releases/download/v%CCACHE_VERSION%/ccache-%CCACHE_VERSION%-windows-%ARCH%.zip -o ccache-%CCACHE_VERSION%.zip || exit /b !errorlevel!
124+
125+
- name: Install ccache
126+
if: steps.cache-ccache.outputs.cache-hit != 'true'
127+
run: |
128+
7z e ccache-%CCACHE_VERSION%.zip -occache || exit /b !errorlevel!
129+
dir ccache
130+
rename ccache\ccache.exe cl.exe || exit /b !errorlevel!
131+
dir ccache
132+
101133
- name: Cache PCRE
102134
id: cache-pcre
103135
uses: actions/cache@v3
@@ -144,6 +176,7 @@ jobs:
144176
)
145177
cmake -S . -B build -DBUILD_TESTS=On || exit /b !errorlevel!
146178
179+
# TODO: use ccache
147180
- name: Build CLI debug configuration using MSBuild
148181
run: |
149182
set ARCH=${{ matrix.arch }}
@@ -163,11 +196,12 @@ jobs:
163196
set ARCH=Win32
164197
)
165198
:: cmake --build build --target check --config Release || exit /b !errorlevel!
166-
msbuild -m cppcheck.sln /p:Configuration=Release-PCRE;Platform=%ARCH% -maxcpucount || exit /b !errorlevel!
199+
msbuild -m cppcheck.sln /p:CLToolPath=D:\a\cppcheck\cppcheck\ccache /p:Configuration=Release-PCRE;Platform=%ARCH% -maxcpucount || exit /b !errorlevel!
167200
168201
- name: Run Release test
169202
run: .\bin\testrunner.exe || exit /b !errorlevel!
170203

204+
# TODO: use Debug build so run-time checks are enabled
171205
- name: Run test/cli
172206
run: |
173207
:: since FILESDIR is not set copy the binary to the root so the addons are found
@@ -210,4 +244,3 @@ jobs:
210244
python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump || exit /b !errorlevel!
211245
..\..\cppcheck --dump namingng_test.c || exit /b !errorlevel!
212246
python3 ..\namingng.py --configfile ..\naming.json --verify namingng_test.c.dump || exit /b !errorlevel!
213-

0 commit comments

Comments
 (0)