Skip to content

Commit deb909e

Browse files
committed
Build swift-inspect in the toolchain workflow.
1 parent c4b3860 commit deb909e

File tree

2 files changed

+156
-2
lines changed

2 files changed

+156
-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: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,9 +2019,93 @@ jobs:
20192019
name: swift-format.exe
20202020
path: ${{ github.workspace }}/SourceCache/swift-format/.build/x86_64-unknown-windows-msvc/release/swift-format.exe
20212021

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

20262110
steps:
20272111
- uses: actions/checkout@v3
@@ -2043,7 +2127,7 @@ jobs:
20432127
20442128
release:
20452129
runs-on: ubuntu-latest
2046-
needs: [smoke_test, swift_format]
2130+
needs: [smoke_test, swift_format, swift_inspect]
20472131

20482132
steps:
20492133
- uses: actions/download-artifact@v3
@@ -2056,6 +2140,11 @@ jobs:
20562140
name: swift-format-msi
20572141
path: ${{ github.workspace }}/tmp
20582142

2143+
- uses: actions/download-artifact@v3
2144+
with:
2145+
name: swift-inspect-msi
2146+
path: ${{ github.workspace }}/tmp
2147+
20592148
- name: compute release name
20602149
id: release_name
20612150
run: |
@@ -2086,4 +2175,12 @@ jobs:
20862175
asset_name: swift-format.msi
20872176
asset_path: ${{ github.workspace }}/tmp/swift-format.msi
20882177
upload_url: ${{ steps.create_release.outputs.upload_url }}
2178+
- uses: actions/[email protected]
2179+
env:
2180+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2181+
with:
2182+
asset_content_type: application/octet-stream
2183+
asset_name: swift-inspect.msi
2184+
asset_path: ${{ github.workspace }}/tmp/swift-inspect.msi
2185+
upload_url: ${{ steps.create_release.outputs.upload_url }}
20892186

0 commit comments

Comments
 (0)