Skip to content
Merged
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
72 changes: 71 additions & 1 deletion .github/workflows/swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4354,6 +4354,10 @@ jobs:
name: Package Windows SDK & Runtime
needs: [stdlib, sdk, experimental-sdk]
runs-on: ${{ inputs.default_build_runner }}
outputs:
expected-dlls-amd64: ${{ steps.write-expectations.outputs.expected-dlls-amd64 }}
expected-dlls-arm64: ${{ steps.write-expectations.outputs.expected-dlls-arm64 }}
expected-dlls-x86: ${{ steps.write-expectations.outputs.expected-dlls-x86 }}

steps:
- uses: actions/[email protected]
Expand Down Expand Up @@ -4626,7 +4630,21 @@ jobs:
-p:WindowsExperimentalRuntimeX64="${{ github.workspace }}/BuildRoot/Library/Developer/Runtimes.Experimental/Windows-x86_64" `
-p:WindowsExperimentalRuntimeX86="${{ github.workspace }}/BuildRoot/Library/Developer/Runtimes.Experimental/Windows-i686" `
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/platforms/windows/windows.wixproj

- name: Write DLL Expectations
id: write-expectations
run: |
@(
@("amd64", "x86_64"),
@("arm64", "aarch64"),
@("x86", "i686")
) | ForEach-Object {
$arch, $suffix = $_
$runtimes = "${{ github.workspace }}/BuildRoot/Library/Developer/Runtimes.Experimental/Windows-$suffix/usr/bin"
Get-ChildItem -Path $runtimes -Filter *.dll -File |
# A flat list collapses down to a space-separated string, so we need to convert to JSON so we can read it later.
ForEach-Object Name | ConvertTo-Json -Compress | ForEach-Object { "expected-dlls-$arch=$_" } |
Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
}
- if: ${{ inputs.release }}
uses: actions/attest-build-provenance@v2
with:
Expand Down Expand Up @@ -5124,6 +5142,58 @@ jobs:
- run: swift test -Xswiftc -DENABLE_TESTING
working-directory: ${{ github.workspace }}/SourceCache/swift-win32

# Ensures redistributables contain all expected DLLs.
redistributable_smoke_test:
if: inputs.build_os == 'Windows'
needs: [package_windows_platform]
runs-on: ${{ inputs.default_build_runner }}
strategy:
fail-fast: false
matrix:
arch: ["amd64", "arm64", "x86"]
variant: ["static", "shared"]
env:
MSM_ARTIFACT_NAME: Windows-${{ matrix.arch }}-rtl-${{ matrix.variant }}-msm
MSM_FILE_NAME: rtl.${{ matrix.variant }}.${{ matrix.arch }}.msm

EXPECTED: >
${{ matrix.variant == 'shared' && (
matrix.arch == 'amd64' && needs.package_windows_platform.outputs.expected-dlls-amd64 ||
matrix.arch == 'arm64' && needs.package_windows_platform.outputs.expected-dlls-arm64 ||
matrix.arch == 'x86' && needs.package_windows_platform.outputs.expected-dlls-x86
) || '["BlocksRuntime.dll", "dispatch.dll"]' }}
steps:
- name: Download MSM
uses: actions/download-artifact@v4
with:
name: ${{ env.MSM_ARTIFACT_NAME }}
path: ${{ runner.temp }}
- name: Test ${{ matrix.variant }} ${{ matrix.arch }}
run: |
$msmPath = Join-Path $env:RUNNER_TEMP $env:MSM_FILE_NAME

$installer = New-Object -ComObject WindowsInstaller.Installer
$db = $installer.OpenDatabase($msmPath, 0)
$view = $db.OpenView("SELECT FileName FROM ``File``")
$view.Execute()

$dlls = @()
while ($record = $view.Fetch()) {
$data = $record.StringData(1)
$file = $data.Split('|')[-1]
if ($file.EndsWith('.dll')) {
$dlls += $file
}
}

$actual = [System.Collections.Generic.HashSet[string]]::new([string[]]$dlls)
$expected = $env:EXPECTED | ConvertFrom-Json
$missing = $expected | Where-Object { -not $actual.Contains($_) }
if ($missing.Count -gt 0) {
$missing | ForEach-Object { Write-Host "::error:: '$_' not found in '$env:MSM_FILE_NAME'" }
exit 1
}

smoke_test_android:
# TODO: Run this job on macOS or make an equivalent Mac-only job
if: inputs.build_os == 'Windows' && inputs.build_android
Expand Down