@@ -56,27 +56,32 @@ runs:
5656 archives : ${{ inputs.os == 'ubuntu-latest' && 'icu qtbase' || 'qtbase' }} qtsvg qtdeclarative qtremoteobjects qttools
5757 cache : true
5858
59- - name : Restore vcpkg from cache
59+ - name : Prepare vcpkg
60+ shell : pwsh
61+ run : |
62+ Write-Output VCPKG_REPO_REF=$((Get-Content scripts/vcpkg-manifest/vcpkg.json | ConvertFrom-Json).'builtin-baseline') >> $env:GITHUB_ENV
63+ Write-Output VCPKG_DEFAULT_BINARY_CACHE=${{ github.workspace }}/vcpkg_archives >> $env:GITHUB_ENV
64+ Write-Output VCPKG_CACHE_HASH=${{ hashFiles('scripts/vcpkg-manifest/vcpkg.json', 'scripts/vcpkg/**') }} >> $env:GITHUB_ENV
65+
66+ - name : Restore vcpkg binary cache from cache
6067 id : cache_vcpkg
6168 uses : actions/cache/restore@v4
6269 with :
63- path : ${{ github.workspace }}/vcpkg
64- key : ${{ runner.os }}-vcpkg-${{ hashFiles('scripts/vcpkg-manifest/vcpkg.json', 'scripts/vcpkg/**') }}
70+ path : ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
71+ key : ${{ runner.os }}-vcpkg-${{ env.VCPKG_REPO_REF }}-${{ env.VCPKG_CACHE_HASH }}
6572 restore-keys : |
66- ${{ runner.os }}-vcpkg-
73+ ${{ runner.os }}-vcpkg-${{ env.VCPKG_REPO_REF }}-
6774
6875 - name : Install vcpkg dependencies
69- if : steps.cache_vcpkg.outputs.cache-hit != 'true'
7076 shell : pwsh
7177 run : |
72- if (!(Test-Path vcpkg)) {
73- git clone https://github.com/microsoft/vcpkg.git
74- cd vcpkg
75- ${{ inputs.os == 'windows-latest' && './bootstrap-vcpkg.bat' || 'sh ./bootstrap-vcpkg.sh' }}
76- } else {
77- cd vcpkg
78- git pull origin master
78+ if (!(Test-Path $env:VCPKG_DEFAULT_BINARY_CACHE)) {
79+ mkdir $env:VCPKG_DEFAULT_BINARY_CACHE
7980 }
81+ git clone https://github.com/microsoft/vcpkg.git
82+ cd vcpkg
83+ ${{ inputs.os == 'windows-latest' && './bootstrap-vcpkg.bat' || 'sh ./bootstrap-vcpkg.sh' }}
84+ git checkout $env:VCPKG_REPO_REF
8085 $env:QT_DIR="$env:Qt5_DIR/lib/cmake/Qt5"
8186 $env:Qt5_DIR=$env:QT_DIR
8287 $env:VCPKG_KEEP_ENV_VARS="QT_DIR;Qt5_DIR"
@@ -91,46 +96,22 @@ runs:
9196 --x-manifest-root=${{ github.workspace }}/scripts/setup/diffscope-bridge `
9297 --x-install-root=./bridge_installed `
9398 --triplet=${{ env.VCPKG_TRIPLET_STATIC }}
94- if (Test-Path -Path buildtrees) {
95- Remove-Item -Path buildtrees -Recurse -Force
96- }
97- if (Test-Path -Path downloads) {
98- Remove-Item -Path downloads -Recurse -Force
99- }
100- if (Test-Path -Path packages) {
101- Remove-Item -Path packages -Recurse -Force
102- }
10399
104100 - name : Save vcpkg to cache
105101 if : steps.cache_vcpkg.outputs.cache-hit != 'true'
106102 uses : actions/cache/save@v4
107103 with :
108- path : ${{ github.workspace }}/vcpkg
109- key : ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }}
110-
111- - name : Restore ASIO SDK from cache
112- id : cache_asiosdk
113- if : inputs.os == 'windows-latest'
114- uses : actions/cache/restore@v4
115- with :
116- path : ${{github.workspace}}/asiosdk
117- key : asiosdk
104+ path : ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
105+ key : ${{ runner.os }}-vcpkg-${{ env.VCPKG_REPO_REF }}-${{ env.VCPKG_CACHE_HASH }}
118106
119107 - name : Get ASIO SDK
120- if : inputs.os == 'windows-latest' && steps.cache_asiosdk.outputs.cache-hit != 'true'
108+ if : inputs.os == 'windows-latest'
121109 shell : pwsh
122110 run : |
123111 Invoke-WebRequest -Uri "https://raw.githubusercontent.com/CrSjimo/diffscope-ci-tools-mirror/refs/heads/main/asiosdk_2.3.3_2019-06-14.zip" -OutFile $env:RUNNER_TEMP/asiosdk.zip
124112 Expand-Archive -Path $env:RUNNER_TEMP/asiosdk.zip -DestinationPath $env:GITHUB_WORKSPACE
125113 Rename-Item -Path asiosdk_2.3.3_2019-06-14 -NewName asiosdk
126114
127- - name : Save ASIO SDK to cache
128- if : inputs.os == 'windows-latest' && steps.cache_asiosdk.outputs.cache-hit != 'true'
129- uses : actions/cache/save@v4
130- with :
131- path : ${{github.workspace}}/asiosdk
132- key : asiosdk
133-
134115 - name : Set directory variables
135116 shell : pwsh
136117 run : |
0 commit comments