diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index 49cc4c05..b632d94d 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -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 }}" @@ -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 } } @@ -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 @@ -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 diff --git a/.github/workflows/test-setup-build.yml b/.github/workflows/test-setup-build.yml index d100592a..8699b30e 100644 --- a/.github/workflows/test-setup-build.yml +++ b/.github/workflows/test-setup-build.yml @@ -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/checkout@v4.2.2 + + - 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/checkout@v4.2.2 + + - 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" + }