43
43
swift_crypto_revision : ${{ steps.context.outputs.swift_crypto_revision }}
44
44
swift_driver_revision : ${{ steps.context.outputs.swift_driver_revision }}
45
45
swift_experimental_string_processing_revision : ${{ steps.context.outputs.swift_experimental_string_processing_revision }}
46
+ swift_format_revision : ${{ steps.context.outputs.swift_format_revision }}
46
47
swift_installer_scripts_revision : ${{ steps.context.outputs.swift_installer_scripts_revision }}
47
48
swift_llbuild_revision : ${{ steps.context.outputs.swift_llbuild_revision }}
48
49
swift_package_manager_revision : ${{ steps.context.outputs.swift_package_manager_revision }}
85
86
swift_crypto_revision=refs/tags/2.4.0
86
87
swift_driver_revision=refs/tags/${{ github.event.inputs.swift_tag }}
87
88
swift_experimental_string_processing_revision=refs/tags/${{ github.event.inputs.swift_tag }}
89
+ swift_format_revision=refs/tags/${{ github.event.inputs.swift_tag }}
88
90
swift_installer_scripts_revision=refs/heads/main
89
91
swift_llbuild_revision=refs/tags/${{ github.event.inputs.swift_tag }}
90
92
swift_package_manager_revision=refs/tags/${{ github.event.inputs.swift_tag }}
@@ -1873,6 +1875,7 @@ jobs:
1873
1875
name : installer-amd64
1874
1876
path : ${{ github.workspace }}/tmp
1875
1877
1878
+ # TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed
1876
1879
- run : |
1877
1880
function Update-EnvironmentVariables {
1878
1881
foreach ($level in "Machine", "User") {
@@ -1918,9 +1921,84 @@ jobs:
1918
1921
- run : swift test -Xswiftc -DENABLE_TESTING
1919
1922
working-directory : ${{ github.workspace }}/SourceCache/swift-win32
1920
1923
1924
+ swift_format :
1925
+ runs-on : windows-latest
1926
+ needs : [context, installer]
1927
+
1928
+ steps :
1929
+ - uses : actions/download-artifact@v3
1930
+ with :
1931
+ name : installer-amd64
1932
+ path : ${{ github.workspace }}/tmp
1933
+
1934
+ # TODO(compnerd) can this be done via a re-usage workflow for swift-format?
1935
+
1936
+ # TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed
1937
+ - run : |
1938
+ function Update-EnvironmentVariables {
1939
+ foreach ($level in "Machine", "User") {
1940
+ [Environment]::GetEnvironmentVariables($level).GetEnumerator() | % {
1941
+ # For Path variables, append the new values, if they're not already in there
1942
+ if ($_.Name -Match 'Path$') {
1943
+ $_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -Split ';' | Select -Unique) -Join ';'
1944
+ }
1945
+ $_
1946
+ } | Set-Content -Path { "Env:$($_.Name)" }
1947
+ }
1948
+ }
1949
+
1950
+ try {
1951
+ Write-Host "Starting Install installer.exe..."
1952
+ $Process = Start-Process -FilePath ${{ github.workspace }}/tmp/installer.exe -ArgumentList ("-q") -Wait -PassThru
1953
+ $ExitCode = $Process.ExitCode
1954
+ if ($ExitCode -eq 0 -or $ExitCode -eq 3010) {
1955
+ Write-Host "Installation successful"
1956
+ } else {
1957
+ Write-Host "non-zero exit code returned by the installation process: $ExitCode"
1958
+ exit $ExitCode
1959
+ }
1960
+ } catch {
1961
+ Write-Host "Failed to install: $($_.Exception.Message)"
1962
+ exit 1
1963
+ }
1964
+ Update-EnvironmentVariables
1965
+
1966
+ # Reset Path and environment
1967
+ echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
1968
+ Get-ChildItem Env: | % { echo "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append }
1969
+
1970
+ - uses : actions/checkout@v3
1971
+ with :
1972
+ repository : apple/swift-format
1973
+ ref : ${{ needs.context.outputs.swift_format_revision }}
1974
+ path : ${{ github.workspace }}/SourceCache/swift-format
1975
+
1976
+ - run : swift test
1977
+ working-directory : ${{ github.workspace }}/SourceCache/swift-format
1978
+
1979
+ - run : swift build -c release -Xswiftc -gnone
1980
+ working-directory : ${{ github.workspace }}/SourceCache/swift-format
1981
+
1982
+ - uses : actions/checkout@v3
1983
+ with :
1984
+ repository : apple/swift-installer-scripts
1985
+ ref : ${{ needs.context.outputs.swift_installer_scripts_revision }}
1986
+ path : ${{ github.workspace }}/SourceCache/swift-installer-scripts
1987
+
1988
+ -
uses :
microsoft/[email protected]
1989
+
1990
+ - run : msbuild ${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/swift-format.wixproj -nologo -restore -p:Configuration=Release -p:SWIFT_FORMAT_BUILD=${{ github.workspace }}\SourceCache\swift-format\.build\release -p:OutputPath=${{ github.workspace }}\artifacts -p:RunWixToolsOutOfProc=true
1991
+
1992
+ - uses : actions/upload-artifact@v2
1993
+ with :
1994
+ name : swift-format
1995
+ path : |
1996
+ ${{ github.workspace }}/.build/release/swift-format.exe
1997
+ ${{ github.workspace }}/artifacts/swift-format.msi
1998
+
1921
1999
snapshot :
1922
2000
runs-on : ubuntu-latest
1923
- needs : [context, smoke_test ]
2001
+ needs : [context, swift_format ]
1924
2002
1925
2003
steps :
1926
2004
- uses : actions/checkout@v3
@@ -1942,7 +2020,7 @@ jobs:
1942
2020
1943
2021
release :
1944
2022
runs-on : ubuntu-latest
1945
- needs : [smoke_test]
2023
+ needs : [smoke_test, swift_format ]
1946
2024
1947
2025
steps :
1948
2026
- uses : actions/download-artifact@v3
0 commit comments