|
1 |
| -name: Swift Linux Matrix |
| 1 | +name: Swift Matrix |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | workflow_call:
|
5 | 5 | inputs:
|
| 6 | + macos_exclude_xcode_versions: |
| 7 | + type: string |
| 8 | + description: "Exclude Xcode version list (JSON)" |
| 9 | + default: "[{\"xcode_version\": \"\"}]" |
| 10 | + macos_versions: |
| 11 | + type: string |
| 12 | + description: "macOS version list (JSON)" |
| 13 | + default: "[\"sequoia\"]" |
| 14 | + macos_archs: |
| 15 | + type: string |
| 16 | + description: "macOS arch list (JSON)" |
| 17 | + default: "[\"ARM64\"]" |
6 | 18 | linux_exclude_swift_versions:
|
7 | 19 | type: string
|
8 | 20 | description: "Exclude Linux Swift version list (JSON)"
|
|
27 | 39 | type: string
|
28 | 40 | description: "Linux command to execute before building the Swift package"
|
29 | 41 | default: ""
|
| 42 | + macos_pre_build_command: |
| 43 | + type: string |
| 44 | + description: "macOS command to execute before building the Swift package" |
| 45 | + default: "" |
| 46 | + macos_build_command: |
| 47 | + type: string |
| 48 | + description: "macOS command to build and test the package" |
| 49 | + default: "swift test" |
30 | 50 | linux_build_command:
|
31 | 51 | type: string
|
32 | 52 | description: "Linux command to build and test the package"
|
|
42 | 62 | Note that Powershell does not automatically exit if a subcommand fails. The Invoke-Program utility is available to propagate non-zero exit codes.
|
43 | 63 | It is strongly encouraged to run all command using `Invoke-Program` unless you want to continue on error eg. `Invoke-Program git apply patch.diff` instead of `git apply patch.diff`.
|
44 | 64 | default: "swift test"
|
| 65 | + macos_env_vars: |
| 66 | + description: "Newline separated list of environment variables" |
| 67 | + type: string |
45 | 68 | linux_env_vars:
|
46 | 69 | description: "Newline separated list of environment variables"
|
47 | 70 | type: string
|
|
52 | 75 | type: boolean
|
53 | 76 | description: "Boolean to enable linux testing. Defaults to true"
|
54 | 77 | default: true
|
| 78 | + enable_macos_checks: |
| 79 | + type: boolean |
| 80 | + description: "Boolean to enable linux testing. Defaults to false" |
| 81 | + default: false |
55 | 82 | enable_windows_checks:
|
56 | 83 | type: boolean
|
57 | 84 | description: "Boolean to enable windows testing. Defaults to true"
|
|
66 | 93 | default: false
|
67 | 94 |
|
68 | 95 | jobs:
|
| 96 | + macos-build: |
| 97 | + name: macOS (Xcode ${{ matrix.xcode_version }} - ${{ matrix.os_version }} - ${{ matrix.arch }}) |
| 98 | + if: ${{ inputs.enable_macos_checks }} |
| 99 | + runs-on: [self-hosted, macos, "${{ matrix.os_version }}", "${{ matrix.arch }}"] |
| 100 | + strategy: |
| 101 | + fail-fast: false |
| 102 | + matrix: |
| 103 | + xcode_version: ['15.4', '16.0', '16.1', '16.2'] |
| 104 | + os_version: ${{ fromJson(inputs.macos_versions) }} |
| 105 | + arch: ${{ fromJson(inputs.macos_archs) }} |
| 106 | + exclude: |
| 107 | + - ${{ fromJson(inputs.macos_exclude_xcode_versions) }} |
| 108 | + steps: |
| 109 | + - name: Checkout repository |
| 110 | + uses: actions/checkout@v4 |
| 111 | + - name: Provide token |
| 112 | + if: ${{ inputs.needs_token }} |
| 113 | + run: | |
| 114 | + echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV |
| 115 | + - name: Set environment variables |
| 116 | + if: ${{ inputs.macos_env_vars }} |
| 117 | + run: | |
| 118 | + for i in "${{ inputs.macos_env_vars }}" |
| 119 | + do |
| 120 | + printf "%s\n" $i >> $GITHUB_ENV |
| 121 | + done |
| 122 | + echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app" >> $GITHUB_ENV |
| 123 | + - name: Swift version |
| 124 | + run: swift --version |
| 125 | + - name: Pre-build |
| 126 | + run: ${{ inputs.macos_pre_build_command }} |
| 127 | + - name: Build / Test |
| 128 | + run: ${{ inputs.macos_build_command }} |
| 129 | + |
69 | 130 | linux-build:
|
70 | 131 | name: Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }})
|
71 | 132 | if: ${{ inputs.enable_linux_checks }}
|
|
0 commit comments