Skip to content

Commit 86729cc

Browse files
committed
Build swift-inspect in the toolchain workflow.
1 parent c67718f commit 86729cc

File tree

4 files changed

+213
-4
lines changed

4 files changed

+213
-4
lines changed

.github/workflows/swift-inspect.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
New-Item -ItemType Directory -Path ${{ github.workspace }}\build
35+
Copy-Item ${{ github.workspace }}\SourceCache\swift\tools\swift-inspect\.build\release\swift-inspect.exe -destination ${{ github.workspace }}\build\
36+
working-directory: ${{ github.workspace }}\SourceCache\swift\tools\swift-inspect
37+
38+
# Package
39+
40+
- uses: actions/checkout@v3
41+
with:
42+
ref: ${{ vars.GITHUB_REF_NAME }}
43+
repository: ${{ vars.GITHUB_REPOSITORY }}
44+
path: ${{ github.workspace }}/SourceCache/${{ vars.GITHUB_REPOSITORY }}
45+
46+
- name: Package
47+
run: |
48+
msbuild -nologo -restore -p:Configuration=Release -p:RunWixToolsOutOfProc=true -p:OutputPath=${{ github.workspace }}\artifacts -p:ProductVersion=5.8 -p:SWIFT_INSPECT_BUILD=${{ github.workspace }}\build ${{ github.workspace }}\SourceCache\${{ vars.GITHUB_REPOSITORY }}\installer-scripts\swift-inspect.wixproj
49+
50+
- uses: actions/upload-artifact@v2
51+
with:
52+
name: swift-inspect
53+
path: |
54+
${{ github.workspace }}/build/swift-inspect.exe
55+
${{ github.workspace }}/artifacts/swift-inspect.msi

.github/workflows/swift-toolchain.yml

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ jobs:
594594
${{ github.workspace }}/BinaryCache/1/**/*.pdb
595595
596596
- uses: microsoft/[email protected]
597-
if: ${{ needs.context.outputs.debug_info }}
597+
if: false # ${{ needs.context.outputs.debug_info }}
598598
with:
599599
accountName: ${{ env.SYMBOL_SERVER_ACCOUNT }}
600600
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -1996,10 +1996,84 @@ jobs:
19961996
${{ github.workspace }}/.build/release/swift-format.exe
19971997
${{ github.workspace }}/artifacts/swift-format.msi
19981998
1999+
swift_inspect:
2000+
runs-on: windows-latest
2001+
needs: [context, installer]
2002+
2003+
steps:
2004+
- uses: actions/download-artifact@v3
2005+
with:
2006+
name: installer-amd64
2007+
path: ${{ github.workspace }}/tmp
2008+
2009+
# TODO(compnerd) can this be done via a re-usage workflow for swift-format?
2010+
2011+
# TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed
2012+
- run: |
2013+
function Update-EnvironmentVariables {
2014+
foreach ($level in "Machine", "User") {
2015+
[Environment]::GetEnvironmentVariables($level).GetEnumerator() | % {
2016+
# For Path variables, append the new values, if they're not already in there
2017+
if ($_.Name -Match 'Path$') {
2018+
$_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -Split ';' | Select -Unique) -Join ';'
2019+
}
2020+
$_
2021+
} | Set-Content -Path { "Env:$($_.Name)" }
2022+
}
2023+
}
2024+
try {
2025+
Write-Host "Starting Install installer.exe..."
2026+
$Process = Start-Process -FilePath ${{ github.workspace }}/tmp/installer.exe -ArgumentList ("-q") -Wait -PassThru
2027+
$ExitCode = $Process.ExitCode
2028+
if ($ExitCode -eq 0 -or $ExitCode -eq 3010) {
2029+
Write-Host "Installation successful"
2030+
} else {
2031+
Write-Host "non-zero exit code returned by the installation process: $ExitCode"
2032+
exit $ExitCode
2033+
}
2034+
} catch {
2035+
Write-Host "Failed to install: $($_.Exception.Message)"
2036+
exit 1
2037+
}
2038+
Update-EnvironmentVariables
2039+
# Reset Path and environment
2040+
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
2041+
Get-ChildItem Env: | % { echo "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append }
2042+
2043+
- uses: microsoft/[email protected]
2044+
2045+
- uses: actions/checkout@v3
2046+
with:
2047+
repository: apple/swift
2048+
ref: ${{ needs.context.outputs.swift_revision }}
2049+
path: ${{ github.workspace }}/SourceCache/swift
2050+
2051+
- run: |
2052+
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
2053+
New-Item -ItemType Directory -Path ${{ github.workspace }}\build
2054+
Copy-Item ${{ github.workspace }}\SourceCache\swift\tools\swift-inspect\.build\release\swift-inspect.exe -destination ${{ github.workspace }}\build\
2055+
working-directory: ${{ github.workspace }}\SourceCache\swift\tools\swift-inspect
2056+
2057+
- uses: actions/checkout@v3
2058+
with:
2059+
ref: ${{ vars.GITHUB_REF_NAME }}
2060+
repository: ${{ vars.GITHUB_REPOSITORY }}
2061+
path: ${{ github.workspace }}/SourceCache/${{ vars.GITHUB_REPOSITORY }}
2062+
2063+
- name: Package
2064+
run: |
2065+
msbuild -nologo -restore -p:Configuration=Release -p:RunWixToolsOutOfProc=true -p:OutputPath=${{ github.workspace }}\artifacts -p:ProductVersion=5.8 -p:SWIFT_INSPECT_BUILD=${{ github.workspace }}\build ${{ github.workspace }}\SourceCache\${{ vars.GITHUB_REPOSITORY }}\installer-scripts\swift-inspect.wixproj
2066+
2067+
- uses: actions/upload-artifact@v2
2068+
with:
2069+
name: swift-inspect
2070+
path: |
2071+
${{ github.workspace }}/build/swift-inspect.exe
2072+
${{ github.workspace }}/artifacts/swift-inspect.msi
2073+
19992074
snapshot:
20002075
runs-on: ubuntu-latest
2001-
needs: [context, swift_format]
2002-
2076+
needs: [context, smoke_test, swift_format, swift_inspect]
20032077
steps:
20042078
- uses: actions/checkout@v3
20052079
with:
@@ -2020,7 +2094,7 @@ jobs:
20202094
20212095
release:
20222096
runs-on: ubuntu-latest
2023-
needs: [smoke_test, swift_format]
2097+
needs: [smoke_test, swift_format, swift_inspect]
20242098

20252099
steps:
20262100
- uses: actions/download-artifact@v3
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Project Sdk="WixToolset.Sdk/4.0.0">
2+
<PropertyGroup>
3+
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
4+
</PropertyGroup>
5+
6+
<PropertyGroup>
7+
<ProductArchitecture Condition=" '$(ProductArchitecture)' == '' ">amd64</ProductArchitecture>
8+
<ProductArchitecture>$(ProductArchitecture)</ProductArchitecture>
9+
10+
<ProductVersion Condition=" '$(ProductVersion)' == '' ">0.0.0</ProductVersion>
11+
<ProductVersion>$(ProductVersion)</ProductVersion>
12+
</PropertyGroup>
13+
14+
<PropertyGroup>
15+
<OutputPath>build\</OutputPath>
16+
<IntermediateOutputPath>build\obj\</IntermediateOutputPath>
17+
</PropertyGroup>
18+
19+
<!-- <Import Project="WiXCodeSigning.targets" /> -->
20+
21+
<PropertyGroup>
22+
<DefineConstants>ProductVersion=$(ProductVersion);ProductArchitecture=$(ProductArchitecture);SWIFT_INSPECT_BUILD=$(SWIFT_INSPECT_BUILD)</DefineConstants>
23+
</PropertyGroup>
24+
25+
<ItemGroup>
26+
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.0" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<Compile Include="swift-inspect.wxs" />
31+
</ItemGroup>
32+
</Project>

installer-scripts/swift-inspect.wxs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
2+
<Package
3+
Language="1033"
4+
Manufacturer="swift.org"
5+
Name="swift-inspect"
6+
UpgradeCode="269fd791-fb3d-4311-96a1-cb98243ee857"
7+
Version="$(var.ProductVersion)"
8+
Scope="perMachine">
9+
<SummaryInformation Description="swift-inspect" />
10+
11+
<!-- NOTE(compnerd) use pre-3.0 schema for better compatibility. -->
12+
<Media Id="1" Cabinet="SwiftFormat.cab" EmbedCab="yes" />
13+
14+
<!-- WindowsVolume is not a StandardDirectory value, but rather a standard property. See https://github.com/wixtoolset/issues/issues/7314 -->
15+
<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]" />
16+
17+
<Directory ComponentGuidGenerationSeed="4541e7ac-4bf7-47f5-adb2-d3f63006cdcb" Id="WINDOWSVOLUME">
18+
<Directory Id="INSTALLDIR">
19+
<Directory Id="Library" Name="Library">
20+
<Directory Id="Developer" Name="Developer">
21+
<Directory Id="Tools" Name="Tools">
22+
<Component Id="swift_inspect.exe">
23+
<File Id="swift_inspect.exe" Source="$(var.SWIFT_INSPECT_BUILD)\swift-inspect.exe" Checksum="yes" />
24+
</Component>
25+
</Directory>
26+
</Directory>
27+
</Directory>
28+
29+
<Component Id="EnvironmentVariables" Guid="61ddbfd1-4051-4964-8a9b-fd0299a358f3">
30+
<Environment Id="Path" Action="set" Name="Path" Part="last" Permanent="no" System="yes" Value="[INSTALLDIR]Library\Developer\Tools" />
31+
</Component>
32+
</Directory>
33+
</Directory>
34+
35+
<Feature Id="SwiftInspect" AllowAbsent="no" AllowAdvertise="yes" ConfigurableDirectory="INSTALLDIR" Description="SwiftInspect" Level="1" Title="SwiftInspect">
36+
<ComponentRef Id="swift_inspect.exe" />
37+
<ComponentRef Id="EnvironmentVariables" />
38+
</Feature>
39+
40+
<UI>
41+
<ui:WixUI Id="WixUI_InstallDir" />
42+
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2" />
43+
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" />
44+
</UI>
45+
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
46+
47+
</Package>
48+
</Wix>

0 commit comments

Comments
 (0)