@@ -4360,6 +4360,10 @@ jobs:
43604360 name : Package Windows SDK & Runtime
43614361 needs : [stdlib, sdk, experimental-sdk]
43624362 runs-on : ${{ inputs.default_build_runner }}
4363+ outputs :
4364+ expected-dlls-amd64 : ${{ steps.write-expectations.outputs.expected-dlls-amd64 }}
4365+ expected-dlls-arm64 : ${{ steps.write-expectations.outputs.expected-dlls-arm64 }}
4366+ expected-dlls-x86 : ${{ steps.write-expectations.outputs.expected-dlls-x86 }}
43634367
43644368 steps :
43654369@@ -4632,7 +4636,21 @@ jobs:
46324636 -p:WindowsExperimentalRuntimeX64="${{ github.workspace }}/BuildRoot/Library/Developer/Runtimes.Experimental/Windows-x86_64" `
46334637 -p:WindowsExperimentalRuntimeX86="${{ github.workspace }}/BuildRoot/Library/Developer/Runtimes.Experimental/Windows-i686" `
46344638 ${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/platforms/windows/windows.wixproj
4635-
4639+ - name : Write DLL Expectations
4640+ id : write-expectations
4641+ run : |
4642+ @(
4643+ @("amd64", "x86_64"),
4644+ @("arm64", "aarch64"),
4645+ @("x86", "i686")
4646+ ) | ForEach-Object {
4647+ $arch, $suffix = $_
4648+ $runtimes = "${{ github.workspace }}/BuildRoot/Library/Developer/Runtimes.Experimental/Windows-$suffix/usr/bin"
4649+ Get-ChildItem -Path $runtimes -Filter *.dll -File |
4650+ # A flat list collapses down to a space-separated string, so we need to convert to JSON so we can read it later.
4651+ ForEach-Object Name | ConvertTo-Json -Compress | ForEach-Object { "expected-dlls-$arch=$_" } |
4652+ Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
4653+ }
46364654 - if : ${{ inputs.release }}
46374655 uses : actions/attest-build-provenance@v2
46384656 with :
@@ -5213,6 +5231,58 @@ jobs:
52135231 - run : swift test -Xswiftc -DENABLE_TESTING
52145232 working-directory : ${{ github.workspace }}/SourceCache/swift-win32
52155233
5234+ # Ensures redistributables contain all expected DLLs.
5235+ redistributable_smoke_test :
5236+ if : inputs.build_os == 'Windows'
5237+ needs : [package_windows_platform]
5238+ runs-on : ${{ inputs.default_build_runner }}
5239+ strategy :
5240+ fail-fast : false
5241+ matrix :
5242+ arch : ["amd64", "arm64", "x86"]
5243+ variant : ["static", "shared"]
5244+ env :
5245+ MSM_ARTIFACT_NAME : Windows-${{ matrix.arch }}-rtl-${{ matrix.variant }}-msm
5246+ MSM_FILE_NAME : rtl.${{ matrix.variant }}.${{ matrix.arch }}.msm
5247+
5248+ EXPECTED : >
5249+ ${{ matrix.variant == 'shared' && (
5250+ matrix.arch == 'amd64' && needs.package_windows_platform.outputs.expected-dlls-amd64 ||
5251+ matrix.arch == 'arm64' && needs.package_windows_platform.outputs.expected-dlls-arm64 ||
5252+ matrix.arch == 'x86' && needs.package_windows_platform.outputs.expected-dlls-x86
5253+ ) || '["BlocksRuntime.dll", "dispatch.dll"]' }}
5254+ steps :
5255+ - name : Download MSM
5256+ uses : actions/download-artifact@v4
5257+ with :
5258+ name : ${{ env.MSM_ARTIFACT_NAME }}
5259+ path : ${{ runner.temp }}
5260+ - name : Test ${{ matrix.variant }} ${{ matrix.arch }}
5261+ run : |
5262+ $msmPath = Join-Path $env:RUNNER_TEMP $env:MSM_FILE_NAME
5263+
5264+ $installer = New-Object -ComObject WindowsInstaller.Installer
5265+ $db = $installer.OpenDatabase($msmPath, 0)
5266+ $view = $db.OpenView("SELECT FileName FROM ``File``")
5267+ $view.Execute()
5268+
5269+ $dlls = @()
5270+ while ($record = $view.Fetch()) {
5271+ $data = $record.StringData(1)
5272+ $file = $data.Split('|')[-1]
5273+ if ($file.EndsWith('.dll')) {
5274+ $dlls += $file
5275+ }
5276+ }
5277+
5278+ $actual = [System.Collections.Generic.HashSet[string]]::new([string[]]$dlls)
5279+ $expected = $env:EXPECTED | ConvertFrom-Json
5280+ $missing = $expected | Where-Object { -not $actual.Contains($_) }
5281+ if ($missing.Count -gt 0) {
5282+ $missing | ForEach-Object { Write-Host "::error:: '$_' not found in '$env:MSM_FILE_NAME'" }
5283+ exit 1
5284+ }
5285+
52165286 smoke_test_android :
52175287 # TODO: Run this job on macOS or make an equivalent Mac-only job
52185288 if : inputs.build_os == 'Windows' && inputs.build_android
0 commit comments