Skip to content

Commit cc50483

Browse files
committed
Only upload the log on failure
1 parent 8f9361e commit cc50483

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ name: Setup build
22
description: Sets up the build environment for the current job
33

44
inputs:
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
115
windows-sdk-version:
126
description: The Windows SDK version to use, e.g. "10.0.22621.0"
137
required: false
@@ -147,13 +141,12 @@ runs:
147141
"--add", "Microsoft.VisualStudio.Component.Windows11SDK.${WinSdkVersionBuild}"
148142
$process.WaitForExit()
149143
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-
153144
if (Test-Path -Path $Win10SdkIncludeVersion -PathType Container) {
154145
Write-Output "ℹ️ Windows SDK ${WinSdkVersionString} installed successfully."
155146
} else {
156147
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
157150
exit 1
158151
}
159152
}
@@ -181,7 +174,7 @@ runs:
181174
if: always() && steps.setup-windows-sdk.outputs.log-file != ''
182175
uses: actions/upload-artifact@v4
183176
with:
184-
name: ${{ inputs.upload-prefix }}-windows-sdk-installer-log
177+
name: ${{ github.job }}-windows-sdk-installer-log
185178
path: ${{ steps.setup-windows-sdk.outputs.log-file }}
186179

187180
- name: Install Windows MSVC version ${{ inputs.msvc-version }}
@@ -226,9 +219,6 @@ runs:
226219
"--add", "Microsoft.VisualStudio.Component.VC.${MSVCPackageVersion}.ATL.ARM64"
227220
$process.WaitForExit()
228221
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-
232222
# Check if the MSVC version was installed successfully.
233223
$MSVCBuildToolsVersion = ""
234224
foreach ($dir in Get-ChildItem -Path $MSVCDir -Directory) {
@@ -242,6 +232,8 @@ runs:
242232
243233
if ($MSVCBuildToolsVersion -eq "") {
244234
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
245237
exit 1
246238
} else {
247239
Write-Output "ℹ️ MSVC ${MSVCBuildToolsVersion} installed successfully."
@@ -252,7 +244,7 @@ runs:
252244
if: always() && steps.setup-msvc.outputs.log-file != ''
253245
uses: actions/upload-artifact@v4
254246
with:
255-
name: ${{ inputs.upload-prefix }}-msvc-installer-log
247+
name: ${{ github.job }}-msvc-installer-log
256248
path: ${{ steps.setup-msvc.outputs.log-file }}
257249

258250
- name: Setup Visual Studio Developer Environment

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636
id: setup-build
3737
uses: ./.github/actions/setup-build
3838
with:
39-
upload-prefix: "test-build-windows-vs-dev-env"
4039
windows-sdk-version: ${{ env.TEST_WIN_SDK_VERSION }}
4140
msvc-version: ${{ env.TEST_MSVC_VERSION }}
4241
setup-vs-dev-env: true
@@ -142,7 +141,6 @@ jobs:
142141
id: setup-build
143142
uses: ./.github/actions/setup-build
144143
with:
145-
upload-prefix: "test-build-windows-no-vs-dev-env"
146144
windows-sdk-version: ${{ env.TEST_WIN_SDK_VERSION }}
147145
msvc-version: ${{ env.TEST_MSVC_VERSION }}
148146
setup-vs-dev-env: false
@@ -241,14 +239,13 @@ jobs:
241239
id: setup-build
242240
uses: ./.github/actions/setup-build
243241
with:
244-
upload-prefix: "test-incorrect-windows-sdk-version"
245242
windows-sdk-version: "99.99.9999.0" # Intentionally incorrect version
246243
continue-on-error: true
247244

248245
- name: Download log file
249246
uses: actions/download-artifact@v4
250247
with:
251-
name: test-incorrect-windows-sdk-version-windows-sdk-installer-log
248+
name: ${{ github.job }}-windows-sdk-installer-log
252249
path: ${{ github.workspace }}/windows-sdk-installer-log
253250

254251
- name: Check the log file existence
@@ -273,14 +270,13 @@ jobs:
273270
id: setup-build
274271
uses: ./.github/actions/setup-build
275272
with:
276-
upload-prefix: "test-incorrect-msvc-version"
277273
msvc-version: "14.99" # Intentionally incorrect version
278274
continue-on-error: true
279275

280276
- name: Download log file
281277
uses: actions/download-artifact@v4
282278
with:
283-
name: test-incorrect-msvc-version-msvc-installer-log
279+
name: ${{ github.job }}-msvc-installer-log
284280
path: ${{ github.workspace }}/msvc-installer-log
285281

286282
- name: Check the log file existence

0 commit comments

Comments
 (0)