-
Notifications
You must be signed in to change notification settings - Fork 33
Add support for macOS platform (default: false) #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fd38e3c
61f0b61
2209c35
482f7f0
f31ba17
737b896
4877266
229a7c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,24 @@ | ||
| name: Swift Linux Matrix | ||
| name: Swift Matrix | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| macos_xcode_versions: | ||
| type: string | ||
| description: "Xcode version list (JSON)" | ||
| default: "[\"16.0\", \"16.1\", \"16.2\", \"16.3\"]" | ||
| macos_exclude_xcode_versions: | ||
| type: string | ||
| description: "Exclude Xcode version list (JSON)" | ||
| default: "[{\"xcode_version\": \"\"}]" | ||
| macos_versions: | ||
| type: string | ||
| description: "macOS version list (JSON)" | ||
| default: "[\"sequoia\"]" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I personally would have probably chosen the release version number (eg. Finally, I think this assumes that we also have a self-hosted runner for this arch + macOS version combination, right? Maybe worth pointing that out in a comment, eg. something like If we don’t have near-term plans to support multiple OSs and arches, I would probably remove the option to not give users a false sense that they can test all macOS + arch + Xcode versions. |
||
| macos_archs: | ||
| type: string | ||
| description: "macOS arch list (JSON)" | ||
| default: "[\"ARM64\"]" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as with the macOS version, I would add a comment like: |
||
| linux_swift_versions: | ||
| type: string | ||
| description: "Include Linux Swift version list (JSON)" | ||
|
|
@@ -35,6 +51,14 @@ on: | |
| type: string | ||
| description: "Linux command to execute before building the Swift package" | ||
| default: "" | ||
| macos_pre_build_command: | ||
| type: string | ||
| description: "macOS command to execute before building the Swift package" | ||
| default: "" | ||
| macos_build_command: | ||
| type: string | ||
| description: "macOS command to build and test the package" | ||
| default: "xcrun swift test" | ||
| linux_build_command: | ||
| type: string | ||
| description: "Linux command to build and test the package" | ||
|
|
@@ -50,6 +74,9 @@ on: | |
| Note that Powershell does not automatically exit if a subcommand fails. The Invoke-Program utility is available to propagate non-zero exit codes. | ||
| 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`. | ||
| default: "swift test" | ||
| macos_env_vars: | ||
| description: "Newline separated list of environment variables" | ||
| type: string | ||
| linux_env_vars: | ||
| description: "Newline separated list of environment variables" | ||
| type: string | ||
|
|
@@ -60,6 +87,10 @@ on: | |
| type: boolean | ||
| description: "Boolean to enable linux testing. Defaults to true" | ||
| default: true | ||
| enable_macos_checks: | ||
| type: boolean | ||
| description: "Boolean to enable macOS testing. Defaults to false" | ||
| default: false | ||
| enable_windows_checks: | ||
| type: boolean | ||
| description: "Boolean to enable windows testing. Defaults to true" | ||
|
|
@@ -74,6 +105,41 @@ on: | |
| default: false | ||
|
|
||
| jobs: | ||
| macos-build: | ||
| name: macOS (Xcode ${{ matrix.xcode_version }} - ${{ matrix.os_version }} - ${{ matrix.arch }}) | ||
| if: ${{ inputs.enable_macos_checks }} | ||
| runs-on: [self-hosted, macos, "${{ matrix.os_version }}", "${{ matrix.arch }}"] | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| xcode_version: ${{ fromJson(inputs.macos_xcode_versions) }} | ||
| os_version: ${{ fromJson(inputs.macos_versions) }} | ||
| arch: ${{ fromJson(inputs.macos_archs) }} | ||
| exclude: | ||
| - ${{ fromJson(inputs.macos_exclude_xcode_versions) }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Provide token | ||
| if: ${{ inputs.needs_token }} | ||
| run: | | ||
| echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV | ||
| - name: Set environment variables | ||
| if: ${{ inputs.macos_env_vars }} | ||
| run: | | ||
| for i in "${{ inputs.macos_env_vars }}" | ||
| do | ||
| printf "%s\n" $i >> $GITHUB_ENV | ||
| done | ||
| - name: Select Xcode | ||
| run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app" >> $GITHUB_ENV | ||
| - name: Swift version | ||
| run: xcrun swift --version | ||
| - name: Pre-build | ||
| run: ${{ inputs.macos_pre_build_command }} | ||
| - name: Build / Test | ||
| run: ${{ inputs.macos_build_command }} | ||
|
|
||
| linux-build: | ||
| name: Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }}) | ||
| if: ${{ inputs.enable_linux_checks }} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be part of
test_with_docker? I would imagine that repos usually define one job that tests all the platforms. I would maybe renametest_with_dockertoTestin that case and then we just havetest_without_dockerleft to test Windows without Docker (and could probably rename totest_windows_without_docker.