@@ -252,6 +252,90 @@ 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+             # Check if Ninja is already installed 
288+             $ninjaPath = Get-Command ninja -ErrorAction SilentlyContinue 
289+             if (-not $ninjaPath) { 
290+               Write-Host "Installing Ninja..." 
291+               # Download Ninja 
292+               $ninjaVersion = "v1.11.1" 
293+               $ninjaUrl = "https://github.com/ninja-build/ninja/releases/download/$ninjaVersion/ninja-win.zip" 
294+               Invoke-WebRequest -Uri $ninjaUrl -OutFile ninja.zip -UserAgent "" 
295+                
296+               # Extract Ninja 
297+               Expand-Archive -Path ninja.zip -DestinationPath ninja 
298+               Move-Item "ninja\ninja.exe" "C:\Windows\System32\" 
299+               Remove-Item ninja.zip 
300+               Remove-Item -Recurse ninja 
301+             } 
302+ 
303+             # Configure sccache 
304+             $env:SCCACHE_CACHE_SIZE = "2G" 
305+             $env:SCCACHE_DIR = "C:\Users\circleci\sccache" 
306+             [Environment]::SetEnvironmentVariable("SCCACHE_CACHE_SIZE", "2G", "Machine") 
307+             [Environment]::SetEnvironmentVariable("SCCACHE_DIR", "C:\Users\circleci\sccache", "Machine") 
308+ 
309+             # Create sccache directory if it doesn't exist 
310+             if (-not (Test-Path "C:\Users\circleci\sccache")) { 
311+               New-Item -ItemType Directory -Path "C:\Users\circleci\sccache" -Force | Out-Null 
312+             } 
313+ 
314+             # Start sccache server and show initial stats 
315+             sccache --stop-server | Out-Null 
316+             sccache --start-server 
317+             Write-Host "sccache initial stats:" 
318+             sccache --show-stats 
319+ shell : powershell.exe 
320+ 
321+   finalize_sccache :
322+     steps :
323+       - run :
324+           name : Show sccache stats 
325+           command : | 
326+             $sccachePath = Get-Command sccache -ErrorAction SilentlyContinue 
327+             if ($sccachePath) { 
328+               Write-Host "sccache final stats:" 
329+               sccache --show-stats 
330+             } else { 
331+               Write-Host "sccache not available" 
332+             } 
333+ shell : powershell.exe 
334+       - save_cache :
335+           key : sccache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "C:\\Users\\circleci\\all-cmake-files.txt" }} 
336+           paths :
337+             - C:\Users\circleci\sccache 
338+ 
255339  setup_prerelease_commit_hash :
256340    steps :
257341      - run :
@@ -1736,10 +1820,12 @@ jobs:
17361820          key : dependencies-win-{{ arch }}-{{ checksum "scripts/install_deps.ps1" }} 
17371821          paths :
17381822            - .\deps 
1823+       - setup_sccache 
17391824      - run :
17401825          name : " Building solidity" 
17411826          command : .circleci/build_win.ps1 
17421827          shell : powershell.exe 
1828+       - finalize_sccache 
17431829      - run :
17441830          name : " Run solc.exe to make sure build was successful." 
17451831          command : .\build\solc\Release\solc.exe --version 
0 commit comments