@@ -2,6 +2,12 @@ name: Setup build
22description : Sets up the build environment for the current job
33
44inputs :
5+ upload-prefix :
6+ description : |
7+ The prefix to use for the uploaded artifacts. This is used to distinguish
8+ between different matrix jobs in the same workflow.
9+ required : true
10+ type : string
511 windows-sdk-version :
612 description : The Windows SDK version to use, e.g. "10.0.22621.0"
713 required : false
@@ -108,6 +114,7 @@ runs:
108114
109115 - name : Install Windows SDK version ${{ inputs.windows-sdk-version }}
110116 if : steps.sanitize-input.outputs.build-os == 'windows' && inputs.windows-sdk-version != ''
117+ id : setup-windows-sdk
111118 shell : pwsh
112119 run : |
113120 $WinSdkVersionString = "${{ inputs.windows-sdk-version }}"
@@ -140,13 +147,13 @@ runs:
140147 "--add", "Microsoft.VisualStudio.Component.Windows11SDK.${WinSdkVersionBuild}"
141148 $process.WaitForExit()
142149
150+ $LogFile = Get-ChildItem "${env:TEMP}" -Filter "dd_installer_*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
151+ "log-file=$($LogFile.FullName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
152+
143153 if (Test-Path -Path $Win10SdkIncludeVersion -PathType Container) {
144154 Write-Output "ℹ️ Windows SDK ${WinSdkVersionString} installed successfully."
145155 } else {
146- Write-Output "::error::Failed to install Windows SDK ${WinSdkVersionString}."
147- Write-Output "Installer log:"
148- $log = Get-ChildItem "${env:TEMP}" -Filter "dd_installer_*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
149- Get-Content $log.FullName
156+ Write-Output "::error::Failed to install Windows SDK ${WinSdkVersionString}. Check the installer log for details."
150157 exit 1
151158 }
152159 }
@@ -170,6 +177,13 @@ runs:
170177 }
171178 }
172179
180+ - name : Upload installer log
181+ if : always() && steps.setup-windows-sdk.outputs.log-file != ''
182+ uses : actions/upload-artifact@v4
183+ with :
184+ name : ${{ inputs.upload-prefix }}-windows-sdk-installer-log
185+ path : ${{ steps.setup-windows-sdk.outputs.log-file }}
186+
173187 - name : Install Windows MSVC version ${{ inputs.msvc-version }}
174188 if : steps.sanitize-input.outputs.build-os == 'windows' && inputs.msvc-version != ''
175189 id : setup-msvc
@@ -212,6 +226,9 @@ runs:
212226 "--add", "Microsoft.VisualStudio.Component.VC.${MSVCPackageVersion}.ATL.ARM64"
213227 $process.WaitForExit()
214228
229+ $LogFile = Get-ChildItem "${env:TEMP}" -Filter "dd_installer_*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
230+ "log-file=$($LogFile.FullName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
231+
215232 # Check if the MSVC version was installed successfully.
216233 $MSVCBuildToolsVersion = ""
217234 foreach ($dir in Get-ChildItem -Path $MSVCDir -Directory) {
@@ -224,16 +241,20 @@ runs:
224241 }
225242
226243 if ($MSVCBuildToolsVersion -eq "") {
227- Write-Output "::error::Failed to install MSVC ${MSVCVersionString}."
228- Write-Output "Installer log:"
229- $log = Get-ChildItem "${env:TEMP}" -Filter "dd_installer_*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
230- Get-Content $log.FullName
244+ Write-Output "::error::Failed to install MSVC ${MSVCVersionString}. Check the installer log for details."
231245 exit 1
232246 } else {
233247 Write-Output "ℹ️ MSVC ${MSVCBuildToolsVersion} installed successfully."
234248 "windows-build-tools-version=${MSVCBuildToolsVersion}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
235249 }
236250
251+ - name : Upload installer log
252+ if : always() && steps.setup-msvc.outputs.log-file != ''
253+ uses : actions/upload-artifact@v4
254+ with :
255+ name : ${{ inputs.upload-prefix }}-msvc-installer-log
256+ path : ${{ steps.setup-msvc.outputs.log-file }}
257+
237258 - name : Setup Visual Studio Developer Environment
238259 if : steps.sanitize-input.outputs.build-os == 'windows' && inputs.setup-vs-dev-env == 'true'
239260 uses : compnerd/gha-setup-vsdevenv@5eb3eae1490d4f7875d574c4973539f69109700d # main
0 commit comments