Skip to content

Upload the VS Installer log #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions .github/actions/setup-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ runs:

- name: Install Windows SDK version ${{ inputs.windows-sdk-version }}
if: steps.sanitize-input.outputs.build-os == 'windows' && inputs.windows-sdk-version != ''
id: setup-windows-sdk
shell: pwsh
run: |
$WinSdkVersionString = "${{ inputs.windows-sdk-version }}"
Expand Down Expand Up @@ -143,10 +144,9 @@ runs:
if (Test-Path -Path $Win10SdkIncludeVersion -PathType Container) {
Write-Output "ℹ️ Windows SDK ${WinSdkVersionString} installed successfully."
} else {
Write-Output "::error::Failed to install Windows SDK ${WinSdkVersionString}."
Write-Output "Installer log:"
$log = Get-ChildItem "${env:TEMP}" -Filter "dd_installer_*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
Get-Content $log.FullName
Write-Output "::error::Failed to install Windows SDK ${WinSdkVersionString}. Check the installer log for details."
$LogFile = Get-ChildItem "${env:TEMP}" -Filter "dd_installer_*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
"log-file=$($LogFile.FullName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
exit 1
}
}
Expand All @@ -170,6 +170,13 @@ runs:
}
}

- name: Upload installer log
if: always() && steps.setup-windows-sdk.outputs.log-file != ''
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-windows-sdk-installer-log
path: ${{ steps.setup-windows-sdk.outputs.log-file }}

- name: Install Windows MSVC version ${{ inputs.msvc-version }}
if: steps.sanitize-input.outputs.build-os == 'windows' && inputs.msvc-version != ''
id: setup-msvc
Expand Down Expand Up @@ -224,16 +231,22 @@ runs:
}

if ($MSVCBuildToolsVersion -eq "") {
Write-Output "::error::Failed to install MSVC ${MSVCVersionString}."
Write-Output "Installer log:"
$log = Get-ChildItem "${env:TEMP}" -Filter "dd_installer_*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
Get-Content $log.FullName
Write-Output "::error::Failed to install MSVC ${MSVCVersionString}. Check the installer log for details."
$LogFile = Get-ChildItem "${env:TEMP}" -Filter "dd_installer_*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
"log-file=$($LogFile.FullName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
exit 1
} else {
Write-Output "ℹ️ MSVC ${MSVCBuildToolsVersion} installed successfully."
"windows-build-tools-version=${MSVCBuildToolsVersion}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
}

- name: Upload installer log
if: always() && steps.setup-msvc.outputs.log-file != ''
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-msvc-installer-log
path: ${{ steps.setup-msvc.outputs.log-file }}

- name: Setup Visual Studio Developer Environment
if: steps.sanitize-input.outputs.build-os == 'windows' && inputs.setup-vs-dev-env == 'true'
uses: compnerd/gha-setup-vsdevenv@5eb3eae1490d4f7875d574c4973539f69109700d # main
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/test-setup-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,65 @@ jobs:
} else {
Write-Output "🎉 All environment checks passed successfully."
}

test-incorrect-windows-sdk-version:
name: Incorrect Windows SDK Version
runs-on: ${{ inputs.windows-runner || 'windows-latest' }}
steps:
- name: Checkout
uses: actions/[email protected]

- name: Set up build with incorrect Windows SDK version
id: setup-build
uses: ./.github/actions/setup-build
with:
windows-sdk-version: "99.99.9999.0" # Intentionally incorrect version
continue-on-error: true

- name: Download log file
uses: actions/download-artifact@v4
with:
name: ${{ github.job }}-windows-sdk-installer-log
path: ${{ github.workspace }}/windows-sdk-installer-log

- name: Check the log file existence
run: |
$LogFile = Get-ChildItem -Path "${{ github.workspace }}/windows-sdk-installer-log"
if (-Not (Test-Path -Path $LogFile)) {
Write-Output "::error::Log file not found."
exit 1
} else {
Write-Output "✅ Log file found. File contents:"
Get-Content -Path "$LogFile"
}

test-incorrect-msvc-version:
name: Incorrect MSVC Version
runs-on: ${{ inputs.windows-runner || 'windows-latest' }}
steps:
- name: Checkout
uses: actions/[email protected]

- name: Set up build with incorrect MSVC version
id: setup-build
uses: ./.github/actions/setup-build
with:
msvc-version: "14.99" # Intentionally incorrect version
continue-on-error: true

- name: Download log file
uses: actions/download-artifact@v4
with:
name: ${{ github.job }}-msvc-installer-log
path: ${{ github.workspace }}/msvc-installer-log

- name: Check the log file existence
run: |
$LogFile = Get-ChildItem -Path "${{ github.workspace }}/msvc-installer-log"
if (-Not (Test-Path -Path $LogFile)) {
Write-Output "::error::Log file not found."
exit 1
} else {
Write-Output "✅ Log file found. File contents:"
Get-Content -Path "$LogFile"
}
Loading