Skip to content

Commit 29a8f44

Browse files
committed
Build swift-inspect in the toolchain workflow.
1 parent 552d86e commit 29a8f44

File tree

2 files changed

+135
-2
lines changed

2 files changed

+135
-2
lines changed

.github/workflows/swift-inspect.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: swift-inspect
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
windows:
8+
runs-on: windows-latest
9+
10+
strategy:
11+
matrix:
12+
include:
13+
- tag: 5.8-RELEASE
14+
branch: swift-5.8-release
15+
16+
steps:
17+
# Build
18+
- uses: compnerd/gha-setup-swift@main
19+
with:
20+
branch: ${{ matrix.branch }}
21+
tag: ${{ matrix.tag }}
22+
23+
- uses: microsoft/[email protected]
24+
25+
- uses: actions/checkout@v3
26+
with:
27+
repository: apple/swift
28+
ref: refs/heads/release/5.8
29+
path: ${{ github.workspace }}/SourceCache/swift
30+
31+
- name: build
32+
run: |
33+
swift build -c release -Xswiftc -gnone -Xcc -I"${env:SDKROOT}"\usr\include\swift\SwiftRemoteMirror -Xlinker ${env:SDKROOT}\usr\lib\swift\windows\x86_64\swiftRemoteMirror.lib
34+
working-directory: ${{ github.workspace }}\SourceCache\swift\tools\swift-inspect
35+
36+
# Package
37+
38+
- uses: actions/checkout@v3
39+
with:
40+
ref: refs/heads/main
41+
repository: apple/swift-installer-scripts
42+
path: ${{ github.workspace }}/SourceCache/swift-installer-scripts
43+
44+
- name: Package
45+
run: |
46+
msbuild -nologo -restore -p:Configuration=Release -p:RunWixToolsOutOfProc=true -p:OutputPath=${{ github.workspace }}\artifacts -p:ProductVersion=5.8 -p:SWIFT_INSPECT_BUILD=${{ github.workspace }}\SourceCache\swift\tools\swift-inspect\.build\release ${{ github.workspace }}\SourceCache\swift-installer-scripts\platforms\Windows\swift-inspect.wixproj
47+
48+
- uses: actions/upload-artifact@v2
49+
with:
50+
name: swift-inspect-msi
51+
path: ${{ github.workspace }}/artifacts/swift-inspect.msi
52+
53+
- uses: actions/upload-artifact@v2
54+
with:
55+
name: swift-inspect.exe
56+
path: ${{ github.workspace }}/SourceCache/swift/tools/swift-inspect/.build/x86_64-unknown-windows-msvc/release/swift-inspect.exe
57+

.github/workflows/swift-toolchain.yml

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,9 +2019,85 @@ jobs:
20192019
name: swift-format.exe
20202020
path: ${{ github.workspace }}/SourceCache/swift-format/.build/release/swift-format.exe
20212021

2022+
swift_inspect:
2023+
runs-on: windows-latest
2024+
needs: [context, installer]
2025+
2026+
steps:
2027+
- uses: actions/download-artifact@v3
2028+
with:
2029+
name: installer-amd64
2030+
path: ${{ github.workspace }}/tmp
2031+
2032+
# TODO(compnerd) can this be done via a re-usage workflow for swift-format?
2033+
2034+
# TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed
2035+
- run: |
2036+
function Update-EnvironmentVariables {
2037+
foreach ($level in "Machine", "User") {
2038+
[Environment]::GetEnvironmentVariables($level).GetEnumerator() | % {
2039+
# For Path variables, append the new values, if they're not already in there
2040+
if ($_.Name -Match 'Path$') {
2041+
$_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -Split ';' | Select -Unique) -Join ';'
2042+
}
2043+
$_
2044+
} | Set-Content -Path { "Env:$($_.Name)" }
2045+
}
2046+
}
2047+
try {
2048+
Write-Host "Starting Install installer.exe..."
2049+
$Process = Start-Process -FilePath ${{ github.workspace }}/tmp/installer.exe -ArgumentList ("-q") -Wait -PassThru
2050+
$ExitCode = $Process.ExitCode
2051+
if ($ExitCode -eq 0 -or $ExitCode -eq 3010) {
2052+
Write-Host "Installation successful"
2053+
} else {
2054+
Write-Host "non-zero exit code returned by the installation process: $ExitCode"
2055+
exit $ExitCode
2056+
}
2057+
} catch {
2058+
Write-Host "Failed to install: $($_.Exception.Message)"
2059+
exit 1
2060+
}
2061+
Update-EnvironmentVariables
2062+
# Reset Path and environment
2063+
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
2064+
Get-ChildItem Env: | % { echo "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append }
2065+
2066+
- uses: microsoft/[email protected]
2067+
2068+
- uses: actions/checkout@v3
2069+
with:
2070+
repository: apple/swift
2071+
ref: ${{ needs.context.outputs.swift_revision }}
2072+
path: ${{ github.workspace }}/SourceCache/swift
2073+
2074+
- run: |
2075+
swift build -c release -Xswiftc -gnone -Xcc -I"${env:SDKROOT}"\usr\include\swift\SwiftRemoteMirror -Xlinker ${env:SDKROOT}\usr\lib\swift\windows\x86_64\swiftRemoteMirror.lib
2076+
working-directory: ${{ github.workspace }}\SourceCache\swift\tools\swift-inspect
2077+
2078+
- uses: actions/checkout@v3
2079+
with:
2080+
ref: ${{ needs.context.outputs.swift_installer_scripts_revision }}
2081+
repository: apple/swift-installer-scripts
2082+
path: ${{ github.workspace }}/SourceCache/swift-installer-scripts
2083+
2084+
- name: Package
2085+
run: |
2086+
msbuild -nologo -restore -p:Configuration=Release -p:RunWixToolsOutOfProc=true -p:OutputPath=${{ github.workspace }}\artifacts -p:ProductVersion=${{ needs.context.outputs.swift_version }} -p:SWIFT_INSPECT_BUILD=${{ github.workspace }}\SourceCache\swift\tools\swift-inspect\.build\release ${{ github.workspace }}\SourceCache\swift-installer-scripts\platforms\Windows\swift-inspect.wixproj
2087+
2088+
- uses: actions/upload-artifact@v2
2089+
with:
2090+
name: swift-inspect-msi
2091+
path: ${{ github.workspace }}/artifacts/swift-inspect.msi
2092+
2093+
- uses: actions/upload-artifact@v2
2094+
with:
2095+
name: swift-inspect.exe
2096+
path: ${{ github.workspace }}/SourceCache/swift/tools/swift-inspect/.build/x86_64-unknown-windows-msvc/release/swift-inspect.exe
2097+
20222098
snapshot:
20232099
runs-on: ubuntu-latest
2024-
needs: [context, swift_format]
2100+
needs: [context, smoke_test, swift_format, swift_inspect]
20252101

20262102
steps:
20272103
- uses: actions/checkout@v3
@@ -2043,7 +2119,7 @@ jobs:
20432119
20442120
release:
20452121
runs-on: ubuntu-latest
2046-
needs: [smoke_test, swift_format]
2122+
needs: [smoke_test, swift_format, swift_inspect]
20472123

20482124
steps:
20492125
- uses: actions/download-artifact@v3

0 commit comments

Comments
 (0)