4545 linux_env_vars :
4646 description : " List of environment variables"
4747 type : string
48+ windows_env_vars :
49+ description : " List of environment variables"
50+ type : string
51+ enable_linux_checks :
52+ type : boolean
53+ description : " Boolean to enable linux testing. Defaults to true"
54+ default : true
4855 enable_windows_checks :
4956 type : boolean
5057 description : " Boolean to enable windows testing. Defaults to true"
5158 default : true
59+ enable_windows_docker :
60+ type : boolean
61+ description : " Boolean to enable running build in windows docker container. Defaults to true"
62+ default : true
5263
5364jobs :
5465 linux-build :
5566 name : Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }})
67+ if : ${{ inputs.enable_linux_checks }}
5668 runs-on : ubuntu-latest
5769 strategy :
5870 fail-fast : false
@@ -97,8 +109,16 @@ jobs:
97109 uses : actions/checkout@v4
98110 with :
99111 ref : ${{ github.ref }} # Include changes to the target branch when action is re-run https://github.com/actions/checkout/issues/1036
112+ - name : Set environment variables
113+ if : ${{ inputs.windows_env_vars }}
114+ run : |
115+ $lines = "${{ inputs.windows_env_vars }}" -split "`r`n"
116+ foreach ($line in $lines) {
117+ echo $line | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
118+ }
100119 - name : Pull Docker image
101120 id : pull_docker_image
121+ if : ${{ inputs.enable_windows_docker }}
102122 run : |
103123 if ("${{ matrix.swift_version }}".Contains("nightly")) {
104124 $Image = "swiftlang/swift:${{ matrix.swift_version }}-windowsservercore-1809"
@@ -107,6 +127,12 @@ jobs:
107127 }
108128 docker pull $Image
109129 echo "image=$Image" >> "$env:GITHUB_OUTPUT"
130+ - name : Install Visual Studio Build Tools
131+ if : ${{ !inputs.enable_windows_docker }}
132+ run : . .github\workflows\scripts\windows\install-vsb.ps1
133+ - name : Install Swift
134+ if : ${{ !inputs.enable_windows_docker }}
135+ run : . .github\workflows\scripts\windows\swift\install-swift-${{ matrix.swift_version }}.ps1
110136 - name : Create test script
111137 run : |
112138 mkdir $env:TEMP\test-script
@@ -127,7 +153,14 @@ jobs:
127153 ${{ inputs.windows_pre_build_command }}
128154 Invoke-Program ${{ inputs.windows_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
129155 '@ >> $env:TEMP\test-script\run.ps1
156+ # Docker build
130157 - name : Build / Test
131158 timeout-minutes : 60
159+ if : ${{ !inputs.enable_windows_docker }}
132160 run : |
133161 docker run -v ${{ github.workspace }}:C:\source -v $env:TEMP\test-script:C:\test-script ${{ steps.pull_docker_image.outputs.image }} powershell.exe -NoLogo -File C:\test-script\run.ps1
162+ # Docker-less build
163+ - name : Build / Test
164+ timeout-minutes : 60
165+ if : ${{ inputs.enable_windows_docker }}
166+ run : powershell.exe -NoLogo -File $env:TEMP\test-script\run.ps1
0 commit comments