Files
swift-nio/.github/workflows/macos_tests.yml
T
Rick Newton-Rogers 301b7c2230 Remove defunct Xcode version inputs from macos_tests.yml (#3591)
### Motivation

  * Xcode 15.4, 16.0, 16.1, 16.2, and 26 beta were already deprecated
and defaulted to `false` with no callers enabling them — redundant code.
  * Xcode 16.3, 16.4, 26.0, and 26.1 will soon be uninstalled from the
runners. Their inputs are kept so downstream callers don't break, but
    they should no longer produce any matrix entries.

  ### Modifications

  * Remove input declarations, shell variables, matrix construction
    blocks, and environment variable mappings for 15.4/16.0/16.1/16.2/26
    beta entirely.
  * Remove the matrix logic for 16.3/16.4/26.0/26.1 but retain the input
    declarations as no-ops, with descriptions communicating they have no
    effect.

  ### Result

  * Less dead code in the shared workflow.
* Callers still passing `xcode_16_3` through `xcode_26_1` inputs get no
    error but also no job — a graceful no-op while they migrate to
    `swift_*` inputs.
2026-05-12 10:33:49 +01:00

445 lines
21 KiB
YAML

name: macOS tests
permissions:
contents: read
on:
workflow_call:
inputs:
xcode_16_3_enabled:
type: boolean
description: "⚠️ Deprecated, has no effect. This Xcode version is no longer installed on the runners."
default: false
xcode_16_3_build_arguments_override:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_16_3_test_arguments_override:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_16_3_setup_command:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_16_4_enabled:
type: boolean
description: "⚠️ Deprecated, has no effect. This Xcode version is no longer installed on the runners."
default: false
xcode_16_4_build_arguments_override:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_16_4_test_arguments_override:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_16_4_setup_command:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_26_0_enabled:
type: boolean
description: "⚠️ Deprecated, has no effect. This Xcode version is no longer installed on the runners."
default: false
xcode_26_0_build_arguments_override:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_26_0_test_arguments_override:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_26_0_setup_command:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_26_1_enabled:
type: boolean
description: "⚠️ Deprecated, has no effect. This Xcode version is no longer installed on the runners."
default: false
xcode_26_1_build_arguments_override:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_26_1_test_arguments_override:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_26_1_setup_command:
type: string
description: "⚠️ Deprecated, has no effect."
default: ""
xcode_26_2_enabled:
type: boolean
description: "⚠️ Jobs with this version of Xcode are deprecated."
default: false
xcode_26_2_build_arguments_override:
type: string
description: "⚠️ Deprecated."
default: ""
xcode_26_2_test_arguments_override:
type: string
description: "⚠️ Deprecated."
default: ""
xcode_26_2_setup_command:
type: string
description: "⚠️ Deprecated."
default: ""
xcode_latest_beta_enabled:
type: boolean
description: "Boolean to enable the Xcode beta jobs (uses latest beta if one currently exists). Defaults to true."
default: false
xcode_latest_beta_build_arguments_override:
type: string
description: "The arguments passed to swift build in the Xcode beta job."
default: ""
xcode_latest_beta_test_arguments_override:
type: string
description: "The arguments passed to swift test in the Xcode beta job."
default: ""
xcode_latest_beta_setup_command:
type: string
description: "The command(s) to be executed before all other work."
default: ""
swift_6_1_enabled:
type: boolean
description: "Boolean to enable the Swift 6.1 jobs. Defaults to true."
default: true
swift_6_1_build_arguments_override:
type: string
description: "The arguments passed to swift build in the Swift 6.1 job."
default: ""
swift_6_1_test_arguments_override:
type: string
description: "The arguments passed to swift test in the Swift 6.1 job."
default: ""
swift_6_1_setup_command:
type: string
description: "The command(s) to be executed before all other work."
default: ""
swift_6_2_enabled:
type: boolean
description: "Boolean to enable the Swift 6.2 jobs. Defaults to true."
default: true
swift_6_2_build_arguments_override:
type: string
description: "The arguments passed to swift build in the Swift 6.2 job."
default: ""
swift_6_2_test_arguments_override:
type: string
description: "The arguments passed to swift test in the Swift 6.2 job."
default: ""
swift_6_2_setup_command:
type: string
description: "The command(s) to be executed before all other work."
default: ""
swift_6_3_enabled:
type: boolean
description: "Boolean to enable the Swift 6.3 jobs. Defaults to true."
default: true
swift_6_3_build_arguments_override:
type: string
description: "The arguments passed to swift build in the Swift 6.3 job."
default: ""
swift_6_3_test_arguments_override:
type: string
description: "The arguments passed to swift test in the Swift 6.3 job."
default: ""
swift_6_3_setup_command:
type: string
description: "The command(s) to be executed before all other work."
default: ""
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."
default: true
macos_xcode_test_enabled:
type: boolean
description: "Boolean to enable the Xcode test targeting macOS. Defaults to false."
default: false
ios_xcode_build_enabled:
type: boolean
description: "Boolean to enable the Xcode build targeting iOS. Defaults to true."
default: true
ios_xcode_test_enabled:
type: boolean
description: "Boolean to enable the Xcode test targeting iOS. Defaults to false."
default: false
watchos_xcode_build_enabled:
type: boolean
description: "Boolean to enable the Xcode build targeting watchOS. Defaults to true."
default: true
watchos_xcode_test_enabled:
type: boolean
description: "Boolean to enable the Xcode test targeting watchOS. Defaults to false."
default: false
tvos_xcode_build_enabled:
type: boolean
description: "Boolean to enable the Xcode build targeting tvOS. Defaults to true."
default: true
tvos_xcode_test_enabled:
type: boolean
description: "Boolean to enable the Xcode test targeting tvOS. Defaults to false."
default: false
visionos_xcode_build_enabled:
type: boolean
description: "Boolean to enable the Xcode build targeting visionOS. Defaults to true."
default: true
visionos_xcode_test_enabled:
type: boolean
description: "Boolean to enable the Xcode test targeting visionOS. Defaults to false."
default: false
runner_pool:
type: string
description: "The runner pool which will be requested."
default: "nightly"
debug_output_enabled:
type: boolean
description: "Boolean to enable debug output from xcodebuild by eliding -quiet. Defaults to false."
default: false
env_vars:
type: string
description: "Environment variables for jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')."
default: "{}"
jobs:
construct-matrix:
name: Construct Darwin matrix
runs-on: ubuntu-latest
outputs:
darwin-matrix: '${{ steps.generate-matrix.outputs.darwin-matrix }}'
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- id: generate-matrix
run: |
# Validate and use JSON environment variables directly
env_vars_json="$INPUT_ENV_VARS"
# Validate JSON format
if ! echo "$env_vars_json" | jq empty 2>/dev/null; then
echo "Error: env_vars is not valid JSON"
exit 1
fi
cat >> "$GITHUB_OUTPUT" << EOM
darwin-matrix=$(
runner_pool="${MATRIX_RUNNER_POOL:="nightly"}"
xcode_26_2_enabled="${MATRIX_MACOS_26_2_ENABLED:=true}"
xcode_26_2_build_arguments_override="${MATRIX_MACOS_26_2_BUILD_ARGUMENTS_OVERRIDE:=""}"
xcode_26_2_test_arguments_override="${MATRIX_MACOS_26_2_TEST_ARGUMENTS_OVERRIDE:=""}"
xcode_26_2_setup_command="${MATRIX_MACOS_26_2_SETUP_COMMAND:=""}"
xcode_latest_beta_enabled="${MATRIX_MACOS_LATEST_BETA_ENABLED:=true}"
xcode_latest_beta_build_arguments_override="${MATRIX_MACOS_LATEST_BETA_BUILD_ARGUMENTS_OVERRIDE:=""}"
xcode_latest_beta_test_arguments_override="${MATRIX_MACOS_LATEST_BETA_TEST_ARGUMENTS_OVERRIDE:=""}"
xcode_latest_beta_setup_command="${MATRIX_MACOS_LATEST_BETA_SETUP_COMMAND:=""}"
swift_6_1_enabled="${MATRIX_SWIFT_6_1_ENABLED:=true}"
swift_6_1_build_arguments_override="${MATRIX_SWIFT_6_1_BUILD_ARGUMENTS_OVERRIDE:=""}"
swift_6_1_test_arguments_override="${MATRIX_SWIFT_6_1_TEST_ARGUMENTS_OVERRIDE:=""}"
swift_6_1_setup_command="${MATRIX_SWIFT_6_1_SETUP_COMMAND:=""}"
swift_6_2_enabled="${MATRIX_SWIFT_6_2_ENABLED:=true}"
swift_6_2_build_arguments_override="${MATRIX_SWIFT_6_2_BUILD_ARGUMENTS_OVERRIDE:=""}"
swift_6_2_test_arguments_override="${MATRIX_SWIFT_6_2_TEST_ARGUMENTS_OVERRIDE:=""}"
swift_6_2_setup_command="${MATRIX_SWIFT_6_2_SETUP_COMMAND:=""}"
swift_6_3_enabled="${MATRIX_SWIFT_6_3_ENABLED:=true}"
swift_6_3_build_arguments_override="${MATRIX_SWIFT_6_3_BUILD_ARGUMENTS_OVERRIDE:=""}"
swift_6_3_test_arguments_override="${MATRIX_SWIFT_6_3_TEST_ARGUMENTS_OVERRIDE:=""}"
swift_6_3_setup_command="${MATRIX_SWIFT_6_3_SETUP_COMMAND:=""}"
# Create matrix from inputs
matrix='{"config": []}'
if [[ "$xcode_26_2_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$xcode_26_2_setup_command" \
--arg build_arguments_override "$xcode_26_2_build_arguments_override" \
--arg test_arguments_override "$xcode_26_2_test_arguments_override" \
--arg runner_pool "$runner_pool" \
--argjson env_vars "$env_vars_json" \
'.config[.config| length] |= . + { "name": "Xcode 26.2", "xcode_version": "26.2", "xcode_app": "Xcode_26.2.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }')
fi
if [[ "$xcode_latest_beta_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$xcode_latest_beta_setup_command" \
--arg build_arguments_override "$xcode_latest_beta_build_arguments_override" \
--arg test_arguments_override "$xcode_latest_beta_test_arguments_override" \
--arg runner_pool "$runner_pool" \
--argjson env_vars "$env_vars_json" \
'.config[.config| length] |= . + { "name": "Xcode latest beta", "xcode_version": "latest beta", "xcode_app": "Xcode-latest.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }')
fi
if [[ "$swift_6_1_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$swift_6_1_setup_command" \
--arg build_arguments_override "$swift_6_1_build_arguments_override" \
--arg test_arguments_override "$swift_6_1_test_arguments_override" \
--arg runner_pool "$runner_pool" \
--argjson env_vars "$env_vars_json" \
'.config[.config| length] |= . + { "name": "Swift 6.1", "xcode_version": "swift 6.1", "xcode_app": "Xcode_swift_6.1.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }')
fi
if [[ "$swift_6_2_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$swift_6_2_setup_command" \
--arg build_arguments_override "$swift_6_2_build_arguments_override" \
--arg test_arguments_override "$swift_6_2_test_arguments_override" \
--arg runner_pool "$runner_pool" \
--argjson env_vars "$env_vars_json" \
'.config[.config| length] |= . + { "name": "Swift 6.2", "xcode_version": "swift 6.2", "xcode_app": "Xcode_swift_6.2.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }')
fi
if [[ "$swift_6_3_enabled" == "true" ]]; then
matrix=$(echo "$matrix" | jq -c \
--arg setup_command "$swift_6_3_setup_command" \
--arg build_arguments_override "$swift_6_3_build_arguments_override" \
--arg test_arguments_override "$swift_6_3_test_arguments_override" \
--arg runner_pool "$runner_pool" \
--argjson env_vars "$env_vars_json" \
'.config[.config| length] |= . + { "name": "Swift 6.3", "xcode_version": "swift 6.3", "xcode_app": "Xcode_swift_6.3.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }')
fi
echo "$matrix" | jq -c
)"
EOM
env:
INPUT_ENV_VARS: ${{ inputs.env_vars }}
MATRIX_RUNNER_POOL: ${{ inputs.runner_pool }}
MATRIX_MACOS_26_2_ENABLED: ${{ inputs.xcode_26_2_enabled }}
MATRIX_MACOS_26_2_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_2_build_arguments_override }}
MATRIX_MACOS_26_2_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_2_test_arguments_override }}
MATRIX_MACOS_26_2_SETUP_COMMAND: ${{ inputs.xcode_26_2_setup_command }}
MATRIX_MACOS_LATEST_BETA_ENABLED: ${{ inputs.xcode_latest_beta_enabled }}
MATRIX_MACOS_LATEST_BETA_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_latest_beta_build_arguments_override }}
MATRIX_MACOS_LATEST_BETA_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_latest_beta_test_arguments_override }}
MATRIX_MACOS_LATEST_BETA_SETUP_COMMAND: ${{ inputs.xcode_latest_beta_setup_command }}
MATRIX_SWIFT_6_1_ENABLED: ${{ inputs.swift_6_1_enabled }}
MATRIX_SWIFT_6_1_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_1_build_arguments_override }}
MATRIX_SWIFT_6_1_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_1_test_arguments_override }}
MATRIX_SWIFT_6_1_SETUP_COMMAND: ${{ inputs.swift_6_1_setup_command }}
MATRIX_SWIFT_6_2_ENABLED: ${{ inputs.swift_6_2_enabled }}
MATRIX_SWIFT_6_2_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_2_build_arguments_override }}
MATRIX_SWIFT_6_2_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_2_test_arguments_override }}
MATRIX_SWIFT_6_2_SETUP_COMMAND: ${{ inputs.swift_6_2_setup_command }}
MATRIX_SWIFT_6_3_ENABLED: ${{ inputs.swift_6_3_enabled }}
MATRIX_SWIFT_6_3_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_3_build_arguments_override }}
MATRIX_SWIFT_6_3_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_3_test_arguments_override }}
MATRIX_SWIFT_6_3_SETUP_COMMAND: ${{ inputs.swift_6_3_setup_command }}
darwin-job:
name: ${{ matrix.config.name }}
needs: construct-matrix
if: github.repository_owner == 'apple'
runs-on: [self-hosted, macos, "${{ matrix.config.os }}", "${{ matrix.config.arch }}", "${{ matrix.config.pool }}"]
timeout-minutes: 60
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.construct-matrix.outputs.darwin-matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
submodules: true
- name: Export environment variables
if: ${{ matrix.config.env != '' && matrix.config.env != '{}'}}
run: |
echo "Exporting environment variables from matrix configuration..."
echo "$MATRIX_ENV_JSON" | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> $GITHUB_ENV
echo "$MATRIX_ENV_JSON" | jq -r 'to_entries[] | "exporting \(.key)=\(.value)"'
env:
MATRIX_ENV_JSON: ${{ toJSON(matrix.config.env) }}
- name: Emit diagnostics
run: |
swift --version
/usr/bin/xcodebuild -version
- name: Setup command
if: ${{ matrix.config.setup_command != '' }}
run: bash -c "$MATRIX_SETUP_COMMAND"
env:
MATRIX_SETUP_COMMAND: ${{ matrix.config.setup_command }}
- name: Swift build
run: |
if [ -n "$MATRIX_BUILD_ARGUMENTS_OVERRIDE" ]; then
swift build $MATRIX_BUILD_ARGUMENTS_OVERRIDE
else
swift build --build-tests
fi
env:
MATRIX_BUILD_ARGUMENTS_OVERRIDE: ${{ matrix.config.build_arguments_override }}
- name: Swift test
if: 'inputs.swift_test_enabled'
run: |
if [ -n "$MATRIX_TEST_ARGUMENTS_OVERRIDE" ]; then
swift test $MATRIX_TEST_ARGUMENTS_OVERRIDE
else
swift test
fi
env:
MATRIX_TEST_ARGUMENTS_OVERRIDE: ${{ matrix.config.test_arguments_override }}
# see `xcodebuild -list` for schemes, `simctl list` for destinations
- name: macOS build
if: '!cancelled() && inputs.macos_xcode_build_enabled'
run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=macos,variant=macos" build
- name: macOS test
if: '!cancelled() && inputs.macos_xcode_test_enabled'
run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=My Mac,variant=macos" test
- name: macOS Catalyst build
if: '!cancelled() && inputs.macos_xcode_build_enabled'
run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=macos,variant=Mac Catalyst" build
- name: macOS Catalyst test
if: '!cancelled() && inputs.macos_xcode_test_enabled'
run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=My Mac,variant=Mac Catalyst" test
- name: iOS build
if: '!cancelled() && inputs.ios_xcode_build_enabled'
run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=ios" build
- name: iOS test
if: '!cancelled() && inputs.ios_xcode_test_enabled'
run: |
/usr/bin/xcrun simctl shutdown all
/usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=iPhone Air" test
- name: watchOS build
if: '!cancelled() && inputs.watchos_xcode_build_enabled'
run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=watchos" build
- name: watchOS test
if: '!cancelled() && inputs.watchos_xcode_test_enabled'
run: |
/usr/bin/xcrun simctl shutdown all
/usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=Apple Watch Ultra 3 (49mm)" test
- name: tvOS build
if: '!cancelled() && inputs.tvos_xcode_build_enabled'
run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=tvos" build
- name: tvOS test
if: '!cancelled() && inputs.tvos_xcode_test_enabled'
run: |
/usr/bin/xcrun simctl shutdown all
/usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=Apple TV 4K (3rd generation)" test
- name: visionOS build # arm only
if: '!cancelled() && inputs.visionos_xcode_build_enabled'
run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=visionos" build
- name: visionOS test # arm only
if: '!cancelled() && inputs.visionos_xcode_test_enabled'
run: |
/usr/bin/xcrun simctl shutdown all
/usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=Apple Vision Pro" test
env:
XCODE_VERSION: ${{ matrix.config.xcode_version }}
DEVELOPER_DIR: "/Applications/${{ matrix.config.xcode_app }}"
BUILD_SCHEME: ${{ inputs.build_scheme }}
QUIET_ARG: ${{ inputs.debug_output_enabled && ' ' || '-quiet' }}