|
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:
|
@@ -76,37 +80,41 @@ jobs:
|
76 | 80 | windows-build:
|
77 | 81 | name: Windows (${{ matrix.swift_version }} - windows-2022)
|
78 | 82 | if: ${{ inputs.enable_windows_checks }}
|
79 |
| - runs-on: windows-2022 |
| 83 | + runs-on: ${{ contains(matrix.swift_version, 'nightly') && 'windows-2019' || 'windows-2022' }} |
80 | 84 | strategy:
|
81 | 85 | fail-fast: false
|
82 | 86 | matrix:
|
83 |
| - swift_version: ['5.9', '6.0'] |
| 87 | + swift_version: ['5.9', '6.0', 'nightly', 'nightly-6.0'] |
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
|
91 |
| - - name: Build / Test |
92 |
| - 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 }}" |
94 |
| - |
95 |
| - windows-nightly-build: |
96 |
| - name: Windows (${{ matrix.swift_version }} - windows-2019) |
97 |
| - if: ${{ inputs.enable_windows_checks }} |
98 |
| - runs-on: windows-2019 |
99 |
| - strategy: |
100 |
| - fail-fast: false |
101 |
| - matrix: |
102 |
| - swift_version: ['nightly', 'nightly-6.0'] |
103 |
| - exclude: |
104 |
| - - ${{ fromJson(inputs.windows_exclude_swift_versions) }} |
105 |
| - steps: |
106 | 93 | - name: Pull Docker image
|
107 |
| - run: docker pull swiftlang/swift:${{ matrix.swift_version }}-windowsservercore-1809 |
108 |
| - - name: Checkout repository |
109 |
| - uses: actions/checkout@v4 |
| 94 | + id: pull_docker_image |
| 95 | + run: | |
| 96 | + if ("${{ matrix.swift_version }}".Contains("nightly")) { |
| 97 | + $Image = "swiftlang/swift:${{ matrix.swift_version }}-windowsservercore-1809" |
| 98 | + } else { |
| 99 | + $Image = "swift:${{ matrix.swift_version }}-windowsservercore-ltsc2022" |
| 100 | + } |
| 101 | + docker pull $Image |
| 102 | + echo "image=$Image" >> "$env:GITHUB_OUTPUT" |
| 103 | + - name: Create test script |
| 104 | + run: | |
| 105 | + mkdir $env:TEMP\test-script |
| 106 | + echo @' |
| 107 | + Set-PSDebug -Trace 1 |
| 108 | + $ErrorActionPreference = "Stop" |
| 109 | + ${{ inputs.windows_pre_build_command }} |
| 110 | + '@ >> $env:TEMP\test-script\pre-build.ps1 |
| 111 | +
|
| 112 | + echo 'swift --version || (exit /b 1)' >> $env:TEMP\test-script\run.cmd |
| 113 | + echo 'swift test --version || (exit /b 1)' >> $env:TEMP\test-script\run.cmd |
| 114 | + echo 'cd C:\source\ || (exit /b 1)' >> $env:TEMP\test-script\run.cmd |
| 115 | + echo 'powershell.exe -NoLogo -File C:\test-script\pre-build.ps1 || (exit /b 1)' >> $env:TEMP\test-script\run.cmd |
| 116 | + echo '${{ inputs.windows_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }} || (exit /b 1)' >> $env:TEMP\test-script\run.cmd |
110 | 117 | - name: Build / Test
|
111 | 118 | 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 }}" |
| 119 | + run: | |
| 120 | + docker run -v ${{ github.workspace }}:C:\source -v $env:TEMP\test-script:C:\test-script ${{ steps.pull_docker_image.outputs.image }} C:\test-script\run.cmd |
0 commit comments