Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions .github/workflows/macos_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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."
Expand All @@ -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."
Expand All @@ -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."
Expand Down Expand Up @@ -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:=""}"
Copy link
Contributor

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?

Copy link
Contributor Author

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.

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:
Expand All @@ -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 }}"
Copy link
Contributor

@glbrntt glbrntt Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking that --build-tests is purposefully dropped here because the args are being overridden?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 }}"
Expand Down
Loading