-
Notifications
You must be signed in to change notification settings - Fork 55
Add workflow to build SwiftFormat. #544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: SwiftFormat | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
windows: | ||
runs-on: windows-latest | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- tag: 0.51.10 | ||
branch: master | ||
|
||
steps: | ||
# Build | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
ref: refs/tags/${{ matrix.tag }} | ||
repository: nicklockwood/SwiftFormat | ||
|
||
- uses: compnerd/gha-setup-swift@main | ||
with: | ||
branch: development | ||
tag: DEVELOPMENT-SNAPSHOT-2023-05-22-a | ||
|
||
- name: test | ||
run: | | ||
swift test | ||
|
||
- name: build | ||
run: | | ||
swift build -c release | ||
|
||
# Package | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
ref: ${{ vars.GITHUB_REF_NAME }} | ||
repository: ${{ vars.GITHUB_REPOSITORY }} | ||
path: ${{ github.workspace }}/SourceCache/${{ vars.GITHUB_REPOSITORY }} | ||
|
||
- uses: microsoft/[email protected] | ||
|
||
- name: package | ||
run: | | ||
msbuild -restore ${{ github.workspace }}\SourceCache\${{ vars.GITHUB_REPOSITORY }}\installer-scripts\SwiftFormat.wixproj -nologo -p:Configuration=Release -p:ProductVersion=${{ matrix.tag }} -p:SWIFTFORMAT_BUILD=${{ github.workspace }}\.build\release -p:OutputPath=${{ github.workspace }}\artifacts -p:RunWixToolsOutOfProc=true | ||
|
||
# Release | ||
- uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
id: create_release | ||
with: | ||
draft: true | ||
prerelease: true | ||
release_name: SwiftFormat-${{ matrix.tag }} | ||
tag_name: SwiftFormat-${{ matrix.tag }} | ||
- uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
asset_content_type: application/octet-stream | ||
asset_name: swiftformat.exe | ||
asset_path: .build\x86_64-unknown-windows-msvc\release\swiftformat.exe | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
- uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
asset_content_type: application/octet-stream | ||
asset_name: SwiftFormat.msi | ||
asset_path: ${{ github.workspace }}\artifacts\SwiftFormat.msi | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,52 @@ | ||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui"> | ||||||
<Package | ||||||
Language="1033" | ||||||
Manufacturer="nicklockwood" | ||||||
Name="SwiftFormat for Windows x86_64" | ||||||
UpgradeCode="98e01ac8-a17d-43fd-99ed-1cd8b58715bf" | ||||||
Version="$(var.ProductVersion)" | ||||||
Scope="perMachine"> | ||||||
<SummaryInformation Description="SwiftFormat for Windows x86_64" /> | ||||||
|
||||||
<!-- NOTE(compnerd) use pre-3.0 schema for better compatibility. --> | ||||||
<Media Id="1" Cabinet="SwiftFormat.cab" EmbedCab="yes" /> | ||||||
|
||||||
<!-- Directory Structure --> | ||||||
<!-- WindowsVolume is not a StandardDirectory value, but rather a standard property. See https://github.com/wixtoolset/issues/issues/7314 --> | ||||||
<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]" /> | ||||||
<Directory ComponentGuidGenerationSeed="7818d7fe-5173-4a41-9809-e72263ea9738" Id="WINDOWSVOLUME"> | ||||||
<Directory Id="INSTALLDIR"> | ||||||
<Directory Id="Library" Name="Library"> | ||||||
<Directory Id="Developer" Name="Developer"> | ||||||
<Directory Id="Tools" Name="Tools"> | ||||||
</Directory> | ||||||
</Directory> | ||||||
</Directory> | ||||||
</Directory> | ||||||
</Directory> | ||||||
|
||||||
<!-- Components --> | ||||||
<ComponentGroup Id="SwiftFormat"> | ||||||
<Component Id="swiftformat.exe" Directory="Tools" Guid="77126634-5f91-40a7-b344-035ce99ef46f"> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be a good opportunity to try removing Component-specific guids. I believe https://github.com/orgs/wixtoolset/discussions/7337
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tristanlabelle I'm getting this error after dropping
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should just merge the directory layout and component bits. That would allow us to remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah if that syntax is valid then that would make sense! I was wondering what was the alternative to what we are doing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @compnerd Any examples or reference on how to merge directory/component? Apple's wsx files follow this unmerged pattern. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hjyamauchi the wxs files there were authored by me and originally in this repository :) I think that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I think I found a way to avoid guid in the .exe component by removing the component group and moving the component into a directory. But it still complains about the EnvironmentVariables component's missing guid when it's moved into a directory. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to this: "Generatable guids are supported only for components with a single file as the component's keypath or no files and a registry value as the keypath." It sounds like the .exe component can have generated guid but not the environment variable one because the latter doesn't have a file or registery value as a child in this case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #549 is what I got far. @compnerd @tristanlabelle Do you see a way to use autogenerated GUID for the environment variable component? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't but it's probably no big deal? I think the guids were local to the installer and even if they were not, it might make sense for the guids to clash if you tried to run multiple installers setting the same environment variable. (not sure) |
||||||
<File Id="swiftformat.exe" Source="$(var.SWIFTFORMAT_BUILD)\swiftformat.exe" Checksum="yes" /> | ||||||
</Component> | ||||||
</ComponentGroup> | ||||||
|
||||||
<Component Id="EnvironmentVariables" Directory="INSTALLDIR" Guid="b46687c3-f836-47e5-9b43-d9fd2552a731"> | ||||||
<Environment Id="Path" Action="set" Name="Path" Part="last" Permanent="no" System="yes" Value="[INSTALLDIR]Library\Developer\Tools" /> | ||||||
</Component> | ||||||
|
||||||
<Feature Id="SwiftFormat" AllowAbsent="no" AllowAdvertise="yes" ConfigurableDirectory="INSTALLDIR" Description="SwiftFormat for Windows x86_64" Level="1" Title="SwiftFormat (Windows x86_64)"> | ||||||
<ComponentGroupRef Id="SwiftFormat" /> | ||||||
<ComponentRef Id="EnvironmentVariables" /> | ||||||
</Feature> | ||||||
|
||||||
<UI> | ||||||
<ui:WixUI Id="WixUI_InstallDir" /> | ||||||
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2" /> | ||||||
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" /> | ||||||
</UI> | ||||||
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property> | ||||||
|
||||||
</Package> | ||||||
</Wix> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui"> | ||
<Package | ||
Language="1033" | ||
Manufacturer="nicklockwood" | ||
Name="SwiftFormat for Windows aarch64" | ||
UpgradeCode="12571ad2-06b7-46e0-9e03-209db2b5667d" | ||
Version="$(var.ProductVersion)" | ||
Scope="perMachine"> | ||
<SummaryInformation Description="SwiftFormat for Windows aarch64" /> | ||
|
||
<!-- NOTE(compnerd) use pre-3.0 schema for better compatibility. --> | ||
<Media Id="1" Cabinet="SwiftFormat.cab" EmbedCab="yes" /> | ||
|
||
<!-- Directory Structure --> | ||
<!-- WindowsVolume is not a StandardDirectory value, but rather a standard property. See https://github.com/wixtoolset/issues/issues/7314 --> | ||
<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]" /> | ||
<Directory ComponentGuidGenerationSeed="ae6cd8c6-6eba-46ff-8784-d432fa64367e" Id="WINDOWSVOLUME"> | ||
<Directory Id="INSTALLDIR"> | ||
<Directory Id="Library" Name="Library"> | ||
<Directory Id="Developer" Name="Developer"> | ||
<Directory Id="Tools" Name="Tools"> | ||
</Directory> | ||
</Directory> | ||
</Directory> | ||
</Directory> | ||
</Directory> | ||
|
||
<!-- Components --> | ||
<ComponentGroup Id="SwiftFormat"> | ||
<Component Id="swiftformat.exe" Directory="Tools" Guid="2803667e-f043-4bf8-94d6-f3926be39597"> | ||
<File Id="swiftformat.exe" Source="$(var.SWIFTFORMAT_BUILD)\swiftformat.exe" Checksum="yes" /> | ||
</Component> | ||
</ComponentGroup> | ||
|
||
<Component Id="EnvironmentVariables" Directory="INSTALLDIR" Guid="9e402459-cfe7-4476-a084-fc613016b626"> | ||
<Environment Id="Path" Action="set" Name="Path" Part="last" Permanent="no" System="yes" Value="[INSTALLDIR]Library\Developer\Tools" /> | ||
</Component> | ||
|
||
<Feature Id="SwiftFormat" AllowAbsent="no" AllowAdvertise="yes" ConfigurableDirectory="INSTALLDIR" Description="SwiftFormat for Windows aarch64" Level="1" Title="SwiftFormat (Windows aarch64)"> | ||
<ComponentGroupRef Id="SwiftFormat" /> | ||
<ComponentRef Id="EnvironmentVariables" /> | ||
</Feature> | ||
|
||
<UI> | ||
<ui:WixUI Id="WixUI_InstallDir" /> | ||
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2" /> | ||
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" /> | ||
</UI> | ||
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property> | ||
|
||
</Package> | ||
</Wix> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="WixToolset.Sdk/4.0.0"> | ||
<PropertyGroup> | ||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<ProductArchitecture Condition=" '$(ProductArchitecture)' == '' ">amd64</ProductArchitecture> | ||
<ProductArchitecture>$(ProductArchitecture)</ProductArchitecture> | ||
|
||
<ProductVersion Condition=" '$(ProductVersion)' == '' ">0.0.0</ProductVersion> | ||
<ProductVersion>$(ProductVersion)</ProductVersion> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<OutputPath>build\</OutputPath> | ||
<IntermediateOutputPath>build\obj\</IntermediateOutputPath> | ||
</PropertyGroup> | ||
|
||
<!-- <Import Project="WiXCodeSigning.targets" /> --> | ||
|
||
<PropertyGroup> | ||
<DefineConstants>ProductVersion=$(ProductVersion);SWIFTFORMAT_BUILD=$(SWIFTFORMAT_BUILD)</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="SwiftFormat-$(ProductArchitecture).wxs" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also a good opportunity to prototype having a single There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the wixtoolset maintainer also said that component GUIDs were not system-global so we could consolidate architectures even if we can't figure out how to remove the GUIDs. |
||
</ItemGroup> | ||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not super familiar with github actions but do we need the matrix here if we'll be building the same tag/branch on all architectures of the build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is originally in @compnerd action because the plan is that this is built for an arbitrary number of toolchain releases when (a future version of) this is upstreamed to nick's SwiftFormat repo. Right now, the matrix is no-op.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The matrix I was using was for the Swift compiler version. Since we are not ABI stable on Windows, we need the release version matrix for the compile still as the standard library will change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mangini did we test building with the 5.7 toolchain and running against a 5.9 toolchain? I'm worried about the ABI instability in the runtime meaning that we won't be able to use the releases with newer toolchains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@compnerd Do you mean that this SwiftFormat binary is dynamically-linked and that its version needs to include the version of the swift compiler that compiled it? If so, I interpret it as that the matrix needs to have both the compiler version and the SwiftFormat version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hjyamauchi correct.
swiftCore
,Foundation
, anddispatch
are always dynamically linked, and the version needs to be the version from the runtime distributed with the toolchain that it was built with. Extending the matrix to both sounds right.