45
45
linux_env_vars :
46
46
description : " List of environment variables"
47
47
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
55
48
enable_windows_checks :
56
49
type : boolean
57
50
description : " Boolean to enable windows testing. Defaults to true"
58
51
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
63
52
64
53
jobs :
65
54
linux-build :
66
55
name : Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }})
67
- if : ${{ inputs.enable_linux_checks }}
68
56
runs-on : ubuntu-latest
69
57
strategy :
70
58
fail-fast : false
@@ -99,22 +87,14 @@ jobs:
99
87
strategy :
100
88
fail-fast : false
101
89
matrix :
102
- swift_version : ['5.9', '5.10', ' 6.0', 'nightly', 'nightly-6.0']
90
+ swift_version : ['5.9', '6.0', 'nightly', 'nightly-6.0']
103
91
exclude :
104
92
- ${{ fromJson(inputs.windows_exclude_swift_versions) }}
105
93
steps :
106
94
- name : Checkout repository
107
95
uses : actions/checkout@v4
108
- - name : Set environment variables
109
- if : ${{ inputs.windows_env_vars }}
110
- run : |
111
- $lines = "${{ inputs.windows_env_vars }}" -split "`r`n"
112
- foreach ($line in $lines) {
113
- echo $line | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
114
- }
115
96
- name : Pull Docker image
116
97
id : pull_docker_image
117
- if : ${{ inputs.enable_windows_docker }}
118
98
run : |
119
99
if ("${{ matrix.swift_version }}".Contains("nightly")) {
120
100
$Image = "swiftlang/swift:${{ matrix.swift_version }}-windowsservercore-1809"
@@ -123,27 +103,9 @@ jobs:
123
103
}
124
104
docker pull $Image
125
105
echo "image=$Image" >> "$env:GITHUB_OUTPUT"
126
- - name : Install Visual Studio Build Tools
127
- if : ${{ !inputs.enable_windows_docker }}
128
- run : |
129
- Invoke-WebRequest -Uri https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/windows/install-vsb.ps1 -OutFile $env:TEMP\install-vsb.ps1
130
- . $env:TEMP\install-vsb.ps1
131
- del $env:TEMP\install-vsb.ps1
132
- - name : Install Swift
133
- if : ${{ !inputs.enable_windows_docker }}
134
- run : |
135
- Invoke-WebRequest -Uri https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/windows/swift/install-swift.ps1 -OutFile $env:TEMP\install-swift.ps1
136
- Invoke-WebRequest -Uri https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/windows/swift/install-swift-${{ matrix.swift_version }}.ps1 -OutFile $env:TEMP\install-swift-${{ matrix.swift_version }}.ps1
137
- . $env:TEMP\install-swift-${{ matrix.swift_version }}.ps1
138
- del $env:TEMP\install-swift*.ps1
139
106
- name : Create test script
140
107
run : |
141
108
mkdir $env:TEMP\test-script
142
- if ("${{ inputs.enable_windows_docker }}" -eq "true") {
143
- $Source = C:\source
144
- } else {
145
- $Source = $env:GITHUB_WORKSPACE
146
- }
147
109
echo @'
148
110
Set-PSDebug -Trace 1
149
111
@@ -157,21 +119,11 @@ jobs:
157
119
}
158
120
Invoke-Program swift --version
159
121
Invoke-Program swift test --version
160
- Invoke-Program cd $Source
122
+ Invoke-Program cd C:\source\
161
123
${{ inputs.windows_pre_build_command }}
162
124
Invoke-Program ${{ inputs.windows_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
163
125
'@ >> $env:TEMP\test-script\run.ps1
164
- # Docker build
165
- - name : Docker Build / Test
166
- timeout-minutes : 60
167
- if : ${{ inputs.enable_windows_docker }}
168
- run : |
169
- 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
170
- # Docker-less build
171
126
- name : Build / Test
172
127
timeout-minutes : 60
173
- if : ${{ !inputs.enable_windows_docker }}
174
128
run : |
175
- Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
176
- RefreshEnv
177
- powershell.exe -NoLogo -File $env:TEMP\test-script\run.ps1; exit $LastExitCode
129
+ 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
0 commit comments