@@ -3,14 +3,18 @@ name: Swift Linux Matrix
33on :
44 workflow_call :
55 inputs :
6- exclude_swift_versions :
6+ linux_exclude_swift_versions :
77 type : string
8- description : " Exclude Swift version list (JSON)"
8+ description : " Exclude Linux Swift version list (JSON)"
99 default : " [{\" swift_version\" : \"\" }]"
10- os_versions :
10+ linux_os_versions :
1111 type : string
12- description : " OS version list (JSON)"
12+ description : " Linux OS version list (JSON)"
1313 default : " [\" jammy\" ]"
14+ windows_exclude_swift_versions :
15+ type : string
16+ description : " Exclude Windows Swift version list (JSON)"
17+ default : " [{\" swift_version\" : \"\" }]"
1418 swift_flags :
1519 type : string
1620 description : " Swift flags for release version"
1923 type : string
2024 description : " Swift flags for nightly version"
2125 default : " "
22- pre_build_command :
26+ linux_pre_build_command :
2327 type : string
24- description : " Command to execute before building the Swift package"
28+ description : " Linux command to execute before building the Swift package"
2529 default : " "
26- build_command :
30+ linux_build_command :
31+ type : string
32+ description : " Linux Build command default is swift test"
33+ default : " swift test"
34+ windows_build_command :
2735 type : string
28- description : " Build command default is swift test"
36+ description : " Linux Build command default is swift test"
2937 default : " swift test"
3038 env_vars :
3139 description : " List of environment variables"
3240 type : string
41+ enable_windows :
42+ type : boolean
43+ description : " Boolean to enable the acceptable language check job. Defaults to true."
44+ default : true
3345
3446jobs :
35- build :
47+ linux- build :
3648 name : Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }})
3749 runs-on : ubuntu-latest
3850 strategy :
3951 fail-fast : false
4052 matrix :
4153 swift_version : ['5.8', '5.9', '5.10', '6.0', 'nightly-main', 'nightly-6.0']
42- os_version : ${{ fromJson(inputs.os_versions ) }}
54+ os_version : ${{ fromJson(inputs.linux_os_versions ) }}
4355 exclude :
44- - ${{ fromJson(inputs.exclude_swift_versions ) }}
56+ - ${{ fromJson(inputs.linux_exclude_swift_versions ) }}
4557 container :
4658 image : ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
4759 steps :
5769 printf "%s\n" $i >> $GITHUB_ENV
5870 done
5971 - name : Pre-build
60- run : ${{ inputs.pre_build_command }}
72+ run : ${{ inputs.linux_pre_build_command }}
6173 - name : Build / Test
62- run : ${{ inputs.build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
74+ run : ${{ inputs.linux_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
75+ windows-build :
76+ name : Windows (${{ matrix.swift_version }} - ${{ matrix.os_version }})
77+ if : ${{ inputs.enable_windows }}
78+ runs-on : windows-2022
79+ strategy :
80+ fail-fast : false
81+ matrix :
82+ swift_version : ['5.9', '5.10', '6.0']
83+ exclude :
84+ - ${{ fromJson(inputs.windows_exclude_swift_versions) }}
85+ steps :
86+ - name : Pull Docker image
87+ run : docker pull swift:${{ matrix.swift_version }}-windowsservercore-ltsc2022
88+ - name : Checkout repository
89+ uses : actions/checkout@v4
90+ - name : Build / Test
91+ 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 }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}"
0 commit comments