Skip to content

Commit e70a455

Browse files
authored
Upload the VS Installer log (#968)
Rather than dumping the log to the bot output, the log file is now uploaded as an artifact named after the job name.
1 parent d406c28 commit e70a455

File tree

2 files changed

+83
-8
lines changed

2 files changed

+83
-8
lines changed

.github/actions/setup-build/action.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ runs:
108108
109109
- name: Install Windows SDK version ${{ inputs.windows-sdk-version }}
110110
if: steps.sanitize-input.outputs.build-os == 'windows' && inputs.windows-sdk-version != ''
111+
id: setup-windows-sdk
111112
shell: pwsh
112113
run: |
113114
$WinSdkVersionString = "${{ inputs.windows-sdk-version }}"
@@ -143,10 +144,9 @@ runs:
143144
if (Test-Path -Path $Win10SdkIncludeVersion -PathType Container) {
144145
Write-Output "ℹ️ Windows SDK ${WinSdkVersionString} installed successfully."
145146
} 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
147+
Write-Output "::error::Failed to install Windows SDK ${WinSdkVersionString}. Check the installer log for details."
148+
$LogFile = Get-ChildItem "${env:TEMP}" -Filter "dd_installer_*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
149+
"log-file=$($LogFile.FullName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
150150
exit 1
151151
}
152152
}
@@ -170,6 +170,13 @@ runs:
170170
}
171171
}
172172
173+
- name: Upload installer log
174+
if: always() && steps.setup-windows-sdk.outputs.log-file != ''
175+
uses: actions/upload-artifact@v4
176+
with:
177+
name: ${{ github.job }}-windows-sdk-installer-log
178+
path: ${{ steps.setup-windows-sdk.outputs.log-file }}
179+
173180
- name: Install Windows MSVC version ${{ inputs.msvc-version }}
174181
if: steps.sanitize-input.outputs.build-os == 'windows' && inputs.msvc-version != ''
175182
id: setup-msvc
@@ -224,16 +231,22 @@ runs:
224231
}
225232
226233
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
234+
Write-Output "::error::Failed to install MSVC ${MSVCVersionString}. Check the installer log for details."
235+
$LogFile = Get-ChildItem "${env:TEMP}" -Filter "dd_installer_*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
236+
"log-file=$($LogFile.FullName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
231237
exit 1
232238
} else {
233239
Write-Output "ℹ️ MSVC ${MSVCBuildToolsVersion} installed successfully."
234240
"windows-build-tools-version=${MSVCBuildToolsVersion}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
235241
}
236242
243+
- name: Upload installer log
244+
if: always() && steps.setup-msvc.outputs.log-file != ''
245+
uses: actions/upload-artifact@v4
246+
with:
247+
name: ${{ github.job }}-msvc-installer-log
248+
path: ${{ steps.setup-msvc.outputs.log-file }}
249+
237250
- name: Setup Visual Studio Developer Environment
238251
if: steps.sanitize-input.outputs.build-os == 'windows' && inputs.setup-vs-dev-env == 'true'
239252
uses: compnerd/gha-setup-vsdevenv@5eb3eae1490d4f7875d574c4973539f69109700d # main

.github/workflows/test-setup-build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,65 @@ jobs:
227227
} else {
228228
Write-Output "🎉 All environment checks passed successfully."
229229
}
230+
231+
test-incorrect-windows-sdk-version:
232+
name: Incorrect Windows SDK Version
233+
runs-on: ${{ inputs.windows-runner || 'windows-latest' }}
234+
steps:
235+
- name: Checkout
236+
uses: actions/[email protected]
237+
238+
- name: Set up build with incorrect Windows SDK version
239+
id: setup-build
240+
uses: ./.github/actions/setup-build
241+
with:
242+
windows-sdk-version: "99.99.9999.0" # Intentionally incorrect version
243+
continue-on-error: true
244+
245+
- name: Download log file
246+
uses: actions/download-artifact@v4
247+
with:
248+
name: ${{ github.job }}-windows-sdk-installer-log
249+
path: ${{ github.workspace }}/windows-sdk-installer-log
250+
251+
- name: Check the log file existence
252+
run: |
253+
$LogFile = Get-ChildItem -Path "${{ github.workspace }}/windows-sdk-installer-log"
254+
if (-Not (Test-Path -Path $LogFile)) {
255+
Write-Output "::error::Log file not found."
256+
exit 1
257+
} else {
258+
Write-Output "✅ Log file found. File contents:"
259+
Get-Content -Path "$LogFile"
260+
}
261+
262+
test-incorrect-msvc-version:
263+
name: Incorrect MSVC Version
264+
runs-on: ${{ inputs.windows-runner || 'windows-latest' }}
265+
steps:
266+
- name: Checkout
267+
uses: actions/[email protected]
268+
269+
- name: Set up build with incorrect MSVC version
270+
id: setup-build
271+
uses: ./.github/actions/setup-build
272+
with:
273+
msvc-version: "14.99" # Intentionally incorrect version
274+
continue-on-error: true
275+
276+
- name: Download log file
277+
uses: actions/download-artifact@v4
278+
with:
279+
name: ${{ github.job }}-msvc-installer-log
280+
path: ${{ github.workspace }}/msvc-installer-log
281+
282+
- name: Check the log file existence
283+
run: |
284+
$LogFile = Get-ChildItem -Path "${{ github.workspace }}/msvc-installer-log"
285+
if (-Not (Test-Path -Path $LogFile)) {
286+
Write-Output "::error::Log file not found."
287+
exit 1
288+
} else {
289+
Write-Output "✅ Log file found. File contents:"
290+
Get-Content -Path "$LogFile"
291+
}

0 commit comments

Comments
 (0)