@@ -31,7 +31,10 @@ concurrency:
3131
3232env :
3333 CTEST_OUTPUT_ON_FAILURE : 1
34- SCCACHE_GHA_ENABLED : " true"
34+ # Sccache GitHub Actions cache backend - currently disabled due to service reliability
35+ # See https://github.com/mozilla/sccache/blob/main/docs/GHA.md for documentation
36+ SCCACHE_GHA_ENABLED : " false"
37+ SCCACHE_GHA_VERSION : " 20260106-1"
3538
3639jobs :
3740
@@ -615,13 +618,45 @@ jobs:
615618 windows :
616619 name : " Windows"
617620 runs-on : windows-latest
621+ permissions :
622+ contents : read
623+ packages : write
618624 env :
619625 CMAKE_PRESET : " msvc-release"
620- VCPKG_BINARY_SOURCES : " clear;x-gha ,readwrite"
626+ VCPKG_BINARY_SOURCES : " clear;nuget,GitHub ,readwrite"
621627 steps :
622628 - uses : actions/checkout@v4
623629 - name : Run sccache-cache
630+ if : env.SCCACHE_GHA_ENABLED == 'true'
624631 uses :
mozilla-actions/[email protected] 632+ continue-on-error : true
633+ id : sccache
634+ - name : " Verify sccache is operational"
635+ if : env.SCCACHE_GHA_ENABLED == 'true'
636+ id : verify_sccache
637+ shell : pwsh
638+ run : |
639+ # If GHA cache is disabled, force local disk cache
640+ # Otherwise, allow the sccache-action's default configuration
641+ if ($env:SCCACHE_GHA_ENABLED -eq "false") {
642+ Write-Host "GHA cache disabled, forcing local disk cache"
643+ echo "SCCACHE_GHA_ENABLED=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
644+ echo "SCCACHE_DIR=$env:LOCALAPPDATA\Mozilla\sccache" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
645+ $env:SCCACHE_GHA_ENABLED = ""
646+ $env:SCCACHE_DIR = "$env:LOCALAPPDATA\Mozilla\sccache"
647+ }
648+
649+ # Quick test to ensure sccache is working
650+ sccache --show-stats
651+ if ($LASTEXITCODE -eq 0) {
652+ Write-Host "Sccache is operational"
653+ echo "sccache_enabled=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
654+ } else {
655+ Write-Host "::warning::Sccache failed, disabling compile caching"
656+ echo "sccache_enabled=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
657+ echo "CMAKE_C_COMPILER_LAUNCHER=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
658+ echo "CMAKE_CXX_COMPILER_LAUNCHER=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
659+ }
625660 - name : setup environment
626661 shell : powershell
627662 id : set_vars
@@ -639,12 +674,14 @@ jobs:
639674 version : " 6.9.*"
640675 # version: "5.15.*"
641676 modules : qtmultimedia qt5compat qtshadertools
642- - name : " Setup vcpkg binary caching"
643- uses : actions/github-script@v7
644- with :
645- script : |
646- core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
647- core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
677+ - name : " Setup NuGet for vcpkg caching"
678+ shell : bash
679+ run : |
680+ dotnet nuget add source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
681+ --name GitHub \
682+ --username "${{ github.repository_owner }}" \
683+ --password "${{ secrets.GITHUB_TOKEN }}" \
684+ --store-password-in-clear-text
648685 - name : " Cache vcpkg"
649686 uses : actions/cache@v4
650687 id : vcpkg-cache
@@ -653,13 +690,24 @@ jobs:
653690 key : vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
654691 restore-keys : |
655692 vcpkg-${{ runner.os }}-
693+ - name : " Upgrade NuGet"
694+ run : |
695+ choco upgrade nuget.commandline -y
656696 - name : " vcpkg: Clone and bootstrap"
657697 if : steps.vcpkg-cache.outputs.cache-hit != 'true'
658698 run : |
659699 git clone --depth 1 https://github.com/microsoft/vcpkg.git ${{ runner.workspace }}\vcpkg
660700 ${{ runner.workspace }}\vcpkg\bootstrap-vcpkg.bat
701+ ${{ runner.workspace }}\vcpkg\vcpkg.exe fetch nuget
702+ env :
703+ VCPKG_BINARY_SOURCES : " clear;nuget,GitHub,readwrite"
704+ - name : " vcpkg: Install dependencies"
705+ shell : pwsh
706+ run : |
707+ ${{ runner.workspace }}\vcpkg\vcpkg.exe install --triplet x64-windows
661708 env :
662- VCPKG_BINARY_SOURCES : " clear;x-gha,readwrite"
709+ VCPKG_ROOT : " ${{ runner.workspace }}/vcpkg"
710+ VCPKG_BINARY_SOURCES : " clear;nuget,GitHub,readwrite"
663711 - name : " Install cmake"
664712665713 - name : " Check cmake version"
@@ -675,6 +723,11 @@ jobs:
675723 shell : pwsh
676724 run : |
677725 cmake --build --preset ${{ env.CMAKE_PRESET }}
726+ - name : " Show sccache statistics"
727+ if : steps.verify_sccache.outputs.sccache_enabled == 'true'
728+ shell : pwsh
729+ run : |
730+ sccache --show-stats
678731 - name : " Test"
679732 shell : pwsh
680733 run : |
0 commit comments