-
Notifications
You must be signed in to change notification settings - Fork 726
Separate build and test steps in macos_tests.yml
#3162
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
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 |
|---|---|---|
|
|
@@ -15,6 +15,10 @@ on: | |
| type: boolean | ||
| description: "Boolean to enable the Xcode version 16.0 jobs. Defaults to true." | ||
| default: true | ||
| xcode_16_0_build_arguments_override: | ||
| type: string | ||
| description: "The arguments passed to swift build in the macOS 5.10 Swift version matrix job." | ||
| default: "" | ||
| xcode_16_0_test_arguments_override: | ||
| type: string | ||
| description: "The arguments passed to swift test in the macOS 5.10 Swift version matrix job." | ||
|
|
@@ -23,6 +27,10 @@ on: | |
| type: boolean | ||
| description: "Boolean to enable the Xcode version 16.1 jobs. Defaults to true." | ||
| default: true | ||
| xcode_16_1_build_arguments_override: | ||
| type: string | ||
| description: "The arguments passed to swift build in the Xcode version 16.1 job." | ||
| default: "" | ||
| xcode_16_1_test_arguments_override: | ||
| type: string | ||
| description: "The arguments passed to swift test in the Xcode version 16.1 job." | ||
|
|
@@ -31,6 +39,10 @@ on: | |
| type: boolean | ||
| description: "Boolean to enable the Xcode version 16.1 jobs. Defaults to true." | ||
| default: true | ||
| xcode_16_2_build_arguments_override: | ||
| type: string | ||
| description: "The arguments passed to swift build in the Xcode version 16.2 job." | ||
| default: "" | ||
| xcode_16_2_test_arguments_override: | ||
| type: string | ||
| description: "The arguments passed to swift test in the Xcode version 16.2 job." | ||
|
|
@@ -39,6 +51,10 @@ on: | |
| build_scheme: | ||
| type: string | ||
| description: "The build scheme used in the Xcode builds." | ||
| swift_test_enabled: | ||
| type: boolean | ||
| description: "Boolean to enable test execution with `swift test`. Defaults to true." | ||
| default: true | ||
| macos_xcode_build_enabled: | ||
| type: boolean | ||
| description: "Boolean to enable the Xcode build targeting macOS. Defaults to true." | ||
|
|
@@ -96,48 +112,56 @@ jobs: | |
| cat >> "$GITHUB_OUTPUT" << EOM | ||
| darwin-matrix=$( | ||
| xcode_15_4_enabled="${MATRIX_MACOS_15_4_ENABLED:=true}" | ||
| xcode_15_4_build_arguments_override="${MATRIX_MACOS_15_4_BUILD_ARGUMENTS_OVERRIDE:=""}" | ||
| xcode_15_4_test_arguments_override="${MATRIX_MACOS_15_4_TEST_ARGUMENTS_OVERRIDE:=""}" | ||
| xcode_16_0_enabled="${MATRIX_MACOS_16_0_ENABLED:=true}" | ||
| xcode_16_0_build_arguments_override="${MATRIX_MACOS_16_0_BUILD_ARGUMENTS_OVERRIDE:=""}" | ||
| xcode_16_0_test_arguments_override="${MATRIX_MACOS_16_0_TEST_ARGUMENTS_OVERRIDE:=""}" | ||
| xcode_16_1_enabled="${MATRIX_MACOS_16_1_ENABLED:=true}" | ||
| xcode_16_1_build_arguments_override="${MATRIX_MACOS_16_1_BUILD_ARGUMENTS_OVERRIDE:=""}" | ||
| xcode_16_1_test_arguments_override="${MATRIX_MACOS_16_1_TEST_ARGUMENTS_OVERRIDE:=""}" | ||
| xcode_16_2_enabled="${MATRIX_MACOS_16_2_ENABLED:=true}" | ||
| xcode_16_2_build_arguments_override="${MATRIX_MACOS_16_2_BUILD_ARGUMENTS_OVERRIDE:=""}" | ||
| xcode_16_2_test_arguments_override="${MATRIX_MACOS_16_2_TEST_ARGUMENTS_OVERRIDE:=""}" | ||
|
|
||
| # Create matrix from inputs | ||
| matrix='{"config": []}' | ||
|
|
||
| if [[ "$xcode_15_4_enabled" == "true" ]]; then | ||
| matrix=$(echo "$matrix" | jq -c \ | ||
| '.config[.config| length] |= . + { "name": "Xcode 15.4", "xcode_version": "15.4", "test_arguments_override": "${xcode_15_4_test_arguments_override}", "os": "sequoia", "arch": "ARM64"}') | ||
| '.config[.config| length] |= . + { "name": "Xcode 15.4", "xcode_version": "15.4", "build_arguments_override": "${xcode_15_4_build_arguments_override}", "test_arguments_override": "${xcode_15_4_test_arguments_override}", "os": "sequoia", "arch": "ARM64"}') | ||
| fi | ||
|
|
||
| if [[ "$xcode_16_0_enabled" == "true" ]]; then | ||
| matrix=$(echo "$matrix" | jq -c \ | ||
| '.config[.config| length] |= . + { "name": "Xcode 16.0", "xcode_version": "16.0", "test_arguments_override": "${xcode_16_0_test_arguments_override}", "os": "sequoia", "arch": "ARM64"}') | ||
| '.config[.config| length] |= . + { "name": "Xcode 16.0", "xcode_version": "16.0", "build_arguments_override": "${xcode_16_0_build_arguments_override}", "test_arguments_override": "${xcode_16_0_test_arguments_override}", "os": "sequoia", "arch": "ARM64"}') | ||
| fi | ||
|
|
||
| if [[ "$xcode_16_1_enabled" == "true" ]]; then | ||
| matrix=$(echo "$matrix" | jq -c \ | ||
| '.config[.config| length] |= . + { "name": "Xcode 16.1", "xcode_version": "16.1", "test_arguments_override": "${xcode_16_1_test_arguments_override}", "os": "sequoia", "arch": "ARM64"}') | ||
| '.config[.config| length] |= . + { "name": "Xcode 16.1", "xcode_version": "16.1", "build_arguments_override": "${xcode_16_1_build_arguments_override}", "test_arguments_override": "${xcode_16_1_test_arguments_override}", "os": "sequoia", "arch": "ARM64"}') | ||
| fi | ||
|
|
||
| if [[ "$xcode_16_2_enabled" == "true" ]]; then | ||
| matrix=$(echo "$matrix" | jq -c \ | ||
| '.config[.config| length] |= . + { "name": "Xcode 16.2", "xcode_version": "16.2", "test_arguments_override": "${xcode_16_2_test_arguments_override}", "os": "sequoia", "arch": "ARM64"}') | ||
| '.config[.config| length] |= . + { "name": "Xcode 16.2", "xcode_version": "16.2", "build_arguments_override": "${xcode_16_2_build_arguments_override}", "test_arguments_override": "${xcode_16_2_test_arguments_override}", "os": "sequoia", "arch": "ARM64"}') | ||
| fi | ||
|
|
||
| echo "$matrix" | jq -c | ||
| )" | ||
| EOM | ||
| env: | ||
| MATRIX_MACOS_15_4_ENABLED: ${{ inputs.xcode_15_4_enabled }} | ||
| MATRIX_MACOS_15_4_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_15_4_build_arguments_override }} | ||
| MATRIX_MACOS_15_4_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_15_4_test_arguments_override }} | ||
| MATRIX_MACOS_16_0_ENABLED: ${{ inputs.xcode_16_0_enabled }} | ||
| MATRIX_MACOS_16_0_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_0_build_arguments_override }} | ||
| MATRIX_MACOS_16_0_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_0_test_arguments_override }} | ||
| MATRIX_MACOS_16_1_ENABLED: ${{ inputs.xcode_16_1_enabled }} | ||
| MATRIX_MACOS_16_1_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_1_build_arguments_override }} | ||
| MATRIX_MACOS_16_1_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_1_test_arguments_override }} | ||
| MATRIX_MACOS_16_2_ENABLED: ${{ inputs.xcode_16_2_enabled }} | ||
| MATRIX_MACOS_16_2_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_2_build_arguments_override }} | ||
| MATRIX_MACOS_16_2_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_2_test_arguments_override }} | ||
|
|
||
| darwin-job: | ||
|
|
@@ -153,7 +177,15 @@ jobs: | |
| with: | ||
| persist-credentials: false | ||
| submodules: true | ||
| - name: Swift build | ||
| run: | | ||
| if [ -n "${{ matrix.config.build_arguments_override }}" ]; then | ||
| swift build "${{ matrix.config.build_arguments_override }}" | ||
|
Contributor
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. Just checking that
Contributor
Author
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. Yeah I thought giving people power to totally customize was more general. |
||
| else | ||
| swift build --build-tests | ||
| fi | ||
| - name: Swift test | ||
| if: 'inputs.swift_test_enabled' | ||
| run: | | ||
| if [ -n "${{ matrix.config.test_arguments_override }}" ]; then | ||
| swift test "${{ matrix.config.test_arguments_override }}" | ||
|
|
||
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.
Do these need to be listed in the
inputs?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.
Good catch. I've not added it to 15.4 since that's deprecated. The bash defaulting should take care of this.