|
22 | 22 | type: string |
23 | 23 | description: "macOS arch list (JSON)" |
24 | 24 | default: "[\"ARM64\"]" |
| 25 | + macos_swiftly_toolchains: |
| 26 | + type: string |
| 27 | + description: "List of macOS Swiftly toolchain builds to test, each pairing an Xcode version with a Swiftly-managed Swift toolchain (JSON list of objects with xcode_version, swift_version, os_version, arch)" |
| 28 | + default: "[{\"xcode_version\": \"26.4\", \"swift_version\": \"main-snapshot\", \"os_version\": \"tahoe\", \"arch\": \"ARM64\"}]" |
25 | 29 | ios_host_xcode_versions: |
26 | 30 | type: string |
27 | 31 | description: "Xcode version list (JSON)" |
|
139 | 143 | type: string |
140 | 144 | description: "macOS command to build and test the package" |
141 | 145 | default: "xcrun swift test" |
| 146 | + macos_swiftly_build_command: |
| 147 | + type: string |
| 148 | + description: "macOS command to build and test the package when using a Swiftly-managed toolchain (run via `swiftly run`, so it should not use `xcrun`)" |
| 149 | + default: "swift test" |
142 | 150 | macos_build_timeout: |
143 | 151 | type: number |
144 | 152 | description: "The default step timeout in minutes" |
|
245 | 253 | type: boolean |
246 | 254 | description: "Boolean to enable macOS testing. Defaults to false" |
247 | 255 | default: false |
| 256 | + enable_macos_swiftly_checks: |
| 257 | + type: boolean |
| 258 | + description: "Boolean to enable macOS testing with Swiftly-managed toolchains (e.g. nightly snapshots). Defaults to false" |
| 259 | + default: false |
248 | 260 | enable_ios_checks: |
249 | 261 | type: boolean |
250 | 262 | description: "Boolean to enable iOS testing. Defaults to false" |
@@ -313,6 +325,46 @@ jobs: |
313 | 325 | run: ${{ inputs.macos_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }} |
314 | 326 | timeout-minutes: ${{ inputs.macos_build_timeout }} |
315 | 327 |
|
| 328 | + macos-swiftly-build: |
| 329 | + name: macOS via Swiftly (Xcode ${{ matrix.xcode_version }} + ${{ matrix.swift_version }} - ${{ matrix.os_version }} - ${{ matrix.arch }}) |
| 330 | + if: ${{ inputs.enable_macos_swiftly_checks }} |
| 331 | + runs-on: [self-hosted, macos, "${{ matrix.os_version }}", "${{ matrix.arch }}"] |
| 332 | + strategy: |
| 333 | + fail-fast: false |
| 334 | + matrix: |
| 335 | + include: ${{ fromJson(inputs.macos_swiftly_toolchains) }} |
| 336 | + steps: |
| 337 | + - name: Checkout repository |
| 338 | + uses: actions/checkout@v7 |
| 339 | + - name: Provide token |
| 340 | + if: ${{ inputs.needs_token }} |
| 341 | + run: | |
| 342 | + echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV |
| 343 | + - name: Set environment variables |
| 344 | + if: ${{ inputs.macos_env_vars }} |
| 345 | + env: |
| 346 | + ENV_VARS: ${{ inputs.macos_env_vars }} |
| 347 | + run: | |
| 348 | + for i in "${ENV_VARS}" |
| 349 | + do |
| 350 | + printf "%s\n" $i >> $GITHUB_ENV |
| 351 | + done |
| 352 | + - name: Select Xcode |
| 353 | + run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app" >> $GITHUB_ENV |
| 354 | + - name: Install Swift toolchain via Swiftly |
| 355 | + run: | |
| 356 | + swiftly install ${{ matrix.swift_version }} |
| 357 | + swiftly use ${{ matrix.swift_version }} |
| 358 | + - name: Swift version |
| 359 | + run: swiftly run swift --version |
| 360 | + - name: Pre-build |
| 361 | + # zizmor: ignore[template-injection] |
| 362 | + run: ${{ inputs.macos_pre_build_command }} |
| 363 | + - name: Build / Test |
| 364 | + # zizmor: ignore[template-injection] |
| 365 | + run: swiftly run ${{ inputs.macos_swiftly_build_command }} ${{ (contains(matrix.swift_version, 'snapshot') && inputs.swift_nightly_flags) || inputs.swift_flags }} |
| 366 | + timeout-minutes: ${{ inputs.macos_build_timeout }} |
| 367 | + |
316 | 368 | ios-build: |
317 | 369 | name: iOS (Build Only, Xcode ${{ matrix.xcode_version }} - ${{ matrix.os_version }} - ${{ matrix.arch }}) |
318 | 370 | if: ${{ inputs.enable_ios_checks }} |
|
0 commit comments