29
29
default : " "
30
30
linux_build_command :
31
31
type : string
32
- description : " Linux Build command default is swift test"
32
+ description : " Linux command to build and test the package "
33
33
default : " swift test"
34
+ windows_pre_build_command :
35
+ type : string
36
+ description : " Windows Command Prompt command to execute before building the Swift package"
37
+ default : " "
34
38
windows_build_command :
35
39
type : string
36
- description : " Linux Build command default is swift test"
40
+ description : " Windows Command Prompt command to build and test the package "
37
41
default : " swift test"
38
42
linux_env_vars :
39
43
description : " List of environment variables"
40
44
type : string
41
45
enable_windows_checks :
42
46
type : boolean
43
- description : " Boolean to enable windows testing. Defaults to true. "
47
+ description : " Boolean to enable windows testing. Defaults to true"
44
48
default : true
45
49
46
50
jobs :
@@ -84,13 +88,27 @@ jobs:
84
88
exclude :
85
89
- ${{ fromJson(inputs.windows_exclude_swift_versions) }}
86
90
steps :
87
- - name : Pull Docker image
88
- run : docker pull swift:${{ matrix.swift_version }}-windowsservercore-ltsc2022
89
91
- name : Checkout repository
90
92
uses : actions/checkout@v4
93
+ - name : Pull Docker image
94
+ run : docker pull swift:${{ matrix.swift_version }}-windowsservercore-ltsc2022
95
+ - name : Create test script
96
+ run : |
97
+ mkdir $env:TEMP\test-script
98
+ echo @'
99
+ Set-PSDebug -Trace 1
100
+ $ErrorActionPreference = "Stop"
101
+ ${{ inputs.windows_pre_build_command }}
102
+ '@ >> $env:TEMP\test-script\pre-build.ps1
103
+
104
+ echo 'swift --version || (exit /b 1)' >> $env:TEMP\test-script\run.cmd
105
+ echo 'swift test --version || (exit /b 1)' >> $env:TEMP\test-script\run.cmd
106
+ echo 'cd C:\source\ || (exit /b 1)' >> $env:TEMP\test-script\run.cmd
107
+ echo 'powershell.exe -NoLogo -File C:\test-script\pre-build.ps1 || (exit /b 1)' >> $env:TEMP\test-script\run.cmd
108
+ echo '${{ inputs.windows_build_command }} ${{ inputs.swift_flags }} || (exit /b 1)' >> $env:TEMP\test-script\run.cmd
91
109
- name : Build / Test
92
110
timeout-minutes : 60
93
- run : docker run -v ${{ github.workspace }}:C:\source swift:${{ matrix.swift_version }}-windowsservercore-ltsc2022 cmd /s /c "swift --version & swift test --version & cd C:\source\ & ${{ inputs.windows_build_command }} ${{ inputs.swift_flags }}"
111
+ run : docker run -v ${{ github.workspace }}:C:\source -v $env:TEMP\test-script:C:\test-script swift:${{ matrix.swift_version }}-windowsservercore-ltsc2022 C:\test-script\run.cmd
94
112
95
113
windows-nightly-build :
96
114
name : Windows (${{ matrix.swift_version }} - windows-2019)
@@ -107,6 +125,20 @@ jobs:
107
125
run : docker pull swiftlang/swift:${{ matrix.swift_version }}-windowsservercore-1809
108
126
- name : Checkout repository
109
127
uses : actions/checkout@v4
128
+ - name : Create test script
129
+ run : |
130
+ mkdir $env:TEMP\test-script
131
+ echo @'
132
+ Set-PSDebug -Trace 1
133
+ $ErrorActionPreference = "Stop"
134
+ ${{ inputs.windows_pre_build_command }}
135
+ '@ >> $env:TEMP\test-script\pre-build.ps1
136
+
137
+ echo 'swift --version || (exit /b 1)' >> $env:TEMP\test-script\run.cmd
138
+ echo 'swift test --version || (exit /b 1)' >> $env:TEMP\test-script\run.cmd
139
+ echo 'cd C:\source\ || (exit /b 1)' >> $env:TEMP\test-script\run.cmd
140
+ echo 'powershell.exe -NoLogo -File C:\test-script\pre-build.ps1 || (exit /b 1)' >> $env:TEMP\test-script\run.cmd
141
+ echo '${{ inputs.windows_build_command }} ${{ inputs.swift_flags }} || (exit /b 1)' >> $env:TEMP\test-script\run.cmd
110
142
- name : Build / Test
111
143
timeout-minutes : 60
112
- run : docker run -v ${{ github.workspace }}:C:\source swiftlang/swift:${{ matrix.swift_version }}-windowsservercore-1809 cmd /s /c "swift --version & swift test --version & cd C:\source\ & ${{ inputs.windows_build_command }} ${{ inputs.swift_nightly_flags }}"
144
+ run : docker run -v ${{ github.workspace }}:C:\source -v $env:TEMP\test-script:C:\test-script swiftlang/swift:${{ matrix.swift_version }}-windowsservercore-1809 C:\test-script\run.cmd
0 commit comments