Skip to content

Commit bae8314

Browse files
authored
GHA: enable early swift driver builds on Windows
This wires up the early swift driver build even though this path does not yet work on Windows. This is preliminary support that is waiting on the last changes to enable the early swift driver on Windows.
1 parent f22c1b6 commit bae8314

File tree

1 file changed

+29
-66
lines changed

1 file changed

+29
-66
lines changed

.github/workflows/swift-toolchain.yml

Lines changed: 29 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -707,28 +707,26 @@ jobs:
707707
${{ steps.export-binary-paths.outputs.swift_compatibility_symbols }}
708708
709709
early_swift_driver:
710-
# TODO: Build this on Windows too.
711-
if: inputs.build_os == 'Darwin'
712-
needs: [sqlite]
713710
runs-on: ${{ inputs.default_build_runner }}
714711

715712
strategy:
716713
fail-fast: false
717-
matrix: ${{ fromJSON(inputs.host_matrix) }}
714+
matrix: ${{ fromJSON(inputs.build_matrix) }}
718715

719-
name: ${{ matrix.os }} ${{ matrix.arch }} Early Swift Driver
716+
name: ${{ matrix.os }} ${{ matrix.arch }} early swift-driver
720717

721718
steps:
722-
- uses: actions/download-artifact@v4
723-
with:
724-
name: sqlite-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_toolchain_sqlite_version }}
725-
path: ${{ github.workspace }}/BuildRoot/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr
726-
727719
- uses: actions/checkout@v4
728720
with:
729721
repository: swiftlang/swift-llbuild
730722
ref: ${{ inputs.swift_llbuild_revision }}
731-
path: ${{ github.workspace }}/SourceCache/swift-llbuild
723+
path: ${{ github.workspace }}/SourceCache/llbuild
724+
show-progress: false
725+
- uses: actions/checkout@v4
726+
with:
727+
repository: swiftlang/swift-toolchain-sqlite
728+
ref: ${{ inputs.swift_toolchain_sqlite_revision }}
729+
path: ${{ github.workspace }}/SourceCache/swift-toolchain-sqlite
732730
show-progress: false
733731
- uses: actions/checkout@v4
734732
with:
@@ -755,78 +753,39 @@ jobs:
755753
path: ${{ github.workspace }}/SourceCache/swift-driver
756754
show-progress: false
757755

758-
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main
759-
with:
760-
host_arch: ${{ inputs.build_arch }}
761-
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
762-
arch: ${{ matrix.arch }}
763-
764-
- uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
765-
if: inputs.build_os == 'Darwin'
766-
767-
- name: Install Swift Toolchain (Mac)
768-
if: inputs.build_os == 'Darwin'
756+
- name: Install Swift Toolchain
769757
uses: compnerd/gha-setup-swift@b6c5fc1ed5b5439ada8e7661985acb09ad8c3ba2 # main
770758
with:
771759
branch: ${{ env.WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_BRANCH }}
772760
tag: ${{ env.WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_TAG }}
773761

774762
- name: Build early swift-driver
775763
run: |
776-
swift build `
777-
--configuration release `
778-
--arch ${{ matrix.arch }} `
779-
--package-path ${{ github.workspace }}/SourceCache/swift-driver `
780-
--build-path ${{ github.workspace }}/BinaryCache/swift-driver `
781-
782-
- name: Create installable package
783-
run: |
784-
if ("${{ matrix.os }}" -eq "Darwin") {
785-
$PlatformName = "macosx"
786-
$ExeSuffix = ""
787-
$Cpu = "${{ matrix.arch }}"
788-
$SourceBinDir = Join-Path "${{ github.workspace }}" "BinaryCache" "swift-driver" "${Cpu}-apple-macosx" "release"
789-
} else {
790-
$PlatformName = "windows"
791-
$ExeSuffix = ".exe"
792-
if ("${{ matrix.arch }}" -eq "ARM64") {
793-
$Cpu = "aarch64"
794-
} else {
795-
$Cpu = "x86_64"
796-
}
797-
$SourceBinDir = Join-Path "${{ github.workspace }}" "BinaryCache" "swift-driver" "${Cpu}-unknown-windows-msvc" "release"
798-
}
799-
800-
# The Swift compiler expects a specific folder name for the early swift-driver build.
801-
# TODO: Make this configurable upstream so we don't have to hardcode it here.
802-
$InstallFolderName = "earlyswiftdriver-${PlatformName}-${Cpu}"
803-
$InstallBinDir = Join-Path "${{ github.workspace }}" "BinaryCache" $InstallFolderName "release" "bin"
804-
805-
# Create the target folder.
806-
New-Item -ItemType Directory -Path $InstallBinDir -Force
764+
$env:SWIFTCI_USE_LOCAL_DEPS=1
807765
808-
# Copy binaries.
809-
$SwiftBinaries = @("swift-driver", "swift-help")
810-
foreach ($bin in $SwiftBinaries) {
811-
$binName = "${bin}${ExeSuffix}"
812-
$binPath = Join-Path $InstallBinDir $binName
813-
Copy-Item -Path "${SourceBinDir}/${binName}" -Destination $binPath -Force
814-
}
766+
swift build `
767+
--configuration release `
768+
--package-path ${{ github.workspace }}/SourceCache/swift-driver `
769+
--build-path ${{ github.workspace }}/BinaryCache/swift-driver `
770+
-Xlinker "${env:SDKROOT}/usr/lib/swift/windows/x86_64/swiftCore.lib"
815771
816-
# Create an archive to preserve permissions.
817-
tar -czf "${{ github.workspace }}/BinaryCache/early-swift-driver.tar.gz" `
818-
-C "${{ github.workspace }}/BinaryCache" `
819-
$InstallFolderName
772+
- id: export-binary-paths
773+
run: |
774+
$Suffix = if ("${{ matrix.os }}" -eq "Windows") { ".exe" } else { "" }
775+
echo "swift_driver=${{ github.workspace }}/BinaryCache/swift-driver/x86_64-unknown-windows-msvc/release/swift-driver${Suffix}" >> $env:GITHUB_OUTPUT
776+
echo "swift_help=${{ github.workspace }}/BinaryCache/swift-driver/x86_64-unknown-windows-msvc/release/swift-help${Suffix}" >> $env:GITHUB_OUTPUT
820777
821778
- uses: actions/upload-artifact@v4
822779
with:
823780
name: early-swift-driver-${{ matrix.os }}-${{ matrix.arch }}
824-
path: ${{ github.workspace }}/BinaryCache/early-swift-driver.tar.gz
781+
path: |
782+
${{ steps.export-binary-paths.outputs.swift_driver }}
783+
${{ steps.export-binary-paths.outputs.swift_help }}
825784
826785
compilers:
827786
# TODO: Build this on macOS or make an equivalent Mac-only job
828787
if: inputs.build_os == 'Windows'
829-
needs: [build_tools, cmark_gfm]
788+
needs: [build_tools, cmark_gfm, early_swift_driver]
830789
runs-on: ${{ inputs.compilers_build_runner }}
831790

832791
env:
@@ -856,6 +815,10 @@ jobs:
856815
with:
857816
name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}
858817
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
818+
- uses: actions/download-artifact@v4
819+
with:
820+
name: early-swift-driver-Windows-amd64
821+
path: ${{ github.workspace }}/BinaryCache/swift-driver/release
859822

860823
- uses: actions/checkout@v4
861824
with:

0 commit comments

Comments
 (0)