@@ -252,6 +252,74 @@ commands:
252252 paths :
253253 - ~/.ccache
254254
255+ setup_sccache :
256+ steps :
257+ - run :
258+ name : Create CMake files checksum
259+ command : |
260+ Get-ChildItem -Path . -Filter "CMakeLists.txt" -Recurse | Get-Content | Out-File -FilePath C:\Users\circleci\all-cmake-files.txt -Encoding UTF8
261+ shell : powershell.exe
262+ - restore_cache :
263+ keys :
264+ - sccache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "C:\\Users\\circleci\\all-cmake-files.txt" }}
265+ - sccache-v1-{{ arch }}-{{ .Branch }}-
266+ - sccache-v1-{{ arch }}-
267+ - run :
268+ name : Install and configure sccache
269+ command : |
270+ # Check if sccache is already installed
271+ $sccachePath = Get-Command sccache -ErrorAction SilentlyContinue
272+ if (-not $sccachePath) {
273+ Write-Host "Installing sccache..."
274+ # Download sccache
275+ $sccacheVersion = "v0.8.2"
276+ $sccacheUrl = "https://github.com/mozilla/sccache/releases/download/$sccacheVersion/sccache-$sccacheVersion-x86_64-pc-windows-msvc.tar.gz"
277+ Invoke-WebRequest -Uri $sccacheUrl -OutFile sccache.tar.gz -UserAgent ""
278+
279+ # Extract sccache
280+ tar -xf sccache.tar.gz
281+ $sccacheDir = Get-ChildItem -Directory -Filter "sccache-*" | Select-Object -First 1
282+ Move-Item "$sccacheDir\sccache.exe" "C:\Windows\System32\"
283+ Remove-Item sccache.tar.gz
284+ Remove-Item -Recurse $sccacheDir
285+ }
286+
287+ # Configure sccache
288+ $env:SCCACHE_CACHE_SIZE = "2G"
289+ $env:SCCACHE_DIR = "C:\Users\circleci\sccache"
290+ [Environment]::SetEnvironmentVariable("SCCACHE_CACHE_SIZE", "2G", "Machine")
291+ [Environment]::SetEnvironmentVariable("SCCACHE_DIR", "C:\Users\circleci\sccache", "Machine")
292+
293+ # Create sccache directory if it doesn't exist
294+ if (-not (Test-Path "C:\Users\circleci\sccache")) {
295+ New-Item -ItemType Directory -Path "C:\Users\circleci\sccache" -Force | Out-Null
296+ }
297+
298+ # Start sccache server and show initial stats
299+ sccache --stop-server | Out-Null
300+ sccache --start-server
301+ Write-Host "sccache initial stats:"
302+ sccache --show-stats
303+ shell : powershell.exe
304+
305+ finalize_sccache :
306+ steps :
307+ - run :
308+ name : Show sccache stats
309+ command : |
310+ $sccachePath = Get-Command sccache -ErrorAction SilentlyContinue
311+ if ($sccachePath) {
312+ Write-Host "sccache final stats:"
313+ sccache --show-stats
314+ } else {
315+ Write-Host "sccache not available"
316+ }
317+ shell : powershell.exe
318+ - save_cache :
319+ key : sccache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "C:\\Users\\circleci\\all-cmake-files.txt" }}
320+ paths :
321+ - C:\Users\circleci\sccache
322+
255323 setup_prerelease_commit_hash :
256324 steps :
257325 - run :
@@ -1736,10 +1804,12 @@ jobs:
17361804 key : dependencies-win-{{ arch }}-{{ checksum "scripts/install_deps.ps1" }}
17371805 paths :
17381806 - .\deps
1807+ - setup_sccache
17391808 - run :
17401809 name : " Building solidity"
17411810 command : .circleci/build_win.ps1
17421811 shell : powershell.exe
1812+ - finalize_sccache
17431813 - run :
17441814 name : " Run solc.exe to make sure build was successful."
17451815 command : .\build\solc\Release\solc.exe --version
0 commit comments