Files
swift-nio/.github/workflows/unit_tests.yml
Rick Newton-Rogers 0f794a4979 Update re-usable workflows to use nightly_next (#3122)
### Motivation:

Updating the CI parameters for changing nightly job targets with each
new Swift version (6.0, 6.1, ...) is onerous. Whilst this gives us some
value in the non-nightly pipelines by forcing adopters to apply thought
to what is applied to each supported version, the nightlies arguably
deliver less value in this regard as they tend to be non-required.

### Modifications:

Change parameters to refer to nightly_next rather than nightly_6_1,
implement
a shim so that the old parameter names still work.

### Result:

We will be able to modify top-level workflows to use nightly_next
terminology.

Test run with an additional commit opting in to use these changes at the
top level
https://github.com/apple/swift-nio/actions/runs/13524774485/job/37792437713?pr=3122
2025-03-03 13:07:39 +00:00

145 lines
6.8 KiB
YAML

name: Unit tests
on:
workflow_call:
inputs:
linux_5_9_enabled:
type: boolean
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true."
default: true
linux_5_9_arguments_override:
type: string
description: "The arguments passed to swift test in the Linux 5.9 Swift version matrix job."
default: ""
linux_5_10_enabled:
type: boolean
description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true."
default: true
linux_5_10_arguments_override:
type: string
description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job."
default: ""
linux_6_0_enabled:
type: boolean
description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true."
default: true
linux_6_0_arguments_override:
type: string
description: "The arguments passed to swift test in the Linux 6.0 Swift version matrix job."
default: ""
linux_nightly_6_0_enabled:
type: boolean
description: "⚠️ Deprecated, we no longer run against 6.0 nightly."
default: true
linux_nightly_6_0_arguments_override:
type: string
description: "⚠️ Deprecated, we no longer run against 6.0 nightly."
default: ""
linux_nightly_6_1_enabled:
type: boolean
description: "⚠️ Deprecated, use linux_nightly_next_enabled."
default: true
linux_nightly_6_1_arguments_override:
type: string
description: "⚠️ Deprecated, use linux_nightly_next_arguments_override."
default: ""
linux_nightly_next_enabled:
type: boolean
description: "Boolean to enable the Linux matrix job using the nightly build for the next Swift version. Defaults to true."
default: true
linux_nightly_next_arguments_override:
type: string
description: "The arguments passed to swift test in the Linux matrix job using the nightly build for the next Swift version."
default: ""
linux_nightly_main_enabled:
type: boolean
description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true."
default: true
linux_nightly_main_arguments_override:
type: string
description: "The arguments passed to swift test in the Linux nightly main Swift version matrix job."
default: ""
windows_6_0_enabled:
type: boolean
description: "Boolean to enable the Windows 6.0 Swift version matrix job. Defaults to false."
default: false
windows_6_0_arguments_override:
type: string
description: "The arguments passed to swift test in the Windows 6.0 Swift version matrix job."
default: ""
windows_nightly_6_0_enabled:
type: boolean
description: "⚠️ Deprecated, we no longer run against 6.0 nightly."
default: false
windows_nightly_6_0_arguments_override:
type: string
description: "⚠️ Deprecated, we no longer run against 6.0 nightly."
default: ""
windows_nightly_6_1_enabled:
type: boolean
description: "⚠️ Deprecated, use windows_nightly_next_enabled."
default: false
windows_nightly_6_1_arguments_override:
type: string
description: "⚠️ Deprecated, use windows_nightly_next_arguments_override."
default: ""
windows_nightly_next_enabled:
type: boolean
description: "Boolean to enable the Windows matrix job using the nightly build for the next Swift version. Defaults to true."
default: true
windows_nightly_next_arguments_override:
type: string
description: "The arguments passed to swift test in the Windows matrix job using the nightly build for the next Swift version."
default: ""
windows_nightly_main_enabled:
type: boolean
description: "Boolean to enable the Windows nightly main Swift version matrix job. Defaults to false."
default: false
windows_nightly_main_arguments_override:
type: string
description: "The arguments passed to swift test in the Windows nightly main Swift version matrix job."
default: ""
jobs:
construct-matrix:
name: Construct unit test matrix
runs-on: ubuntu-latest
outputs:
unit-test-matrix: '${{ steps.generate-matrix.outputs.unit-test-matrix }}'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- id: generate-matrix
run: echo "unit-test-matrix=$(curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT"
env:
MATRIX_LINUX_COMMAND: "swift test"
MATRIX_LINUX_5_9_ENABLED: ${{ inputs.linux_5_9_enabled }}
MATRIX_LINUX_5_9_COMMAND_ARGUMENTS: ${{ inputs.linux_5_9_arguments_override }}
MATRIX_LINUX_5_10_ENABLED: ${{ inputs.linux_5_10_enabled }}
MATRIX_LINUX_5_10_COMMAND_ARGUMENTS: ${{ inputs.linux_5_10_arguments_override }}
MATRIX_LINUX_6_0_ENABLED: ${{ inputs.linux_6_0_enabled }}
MATRIX_LINUX_6_0_COMMAND_ARGUMENTS: ${{ inputs.linux_6_0_arguments_override }}
MATRIX_LINUX_NIGHTLY_NEXT_ENABLED: ${{ inputs.linux_nightly_6_1_enabled && inputs.linux_nightly_next_enabled }}
MATRIX_LINUX_NIGHTLY_NEXT_COMMAND_ARGUMENTS: ${{ inputs.linux_nightly_6_1_arguments_override }} ${{ inputs.linux_nightly_next_arguments_override }}
MATRIX_LINUX_NIGHTLY_MAIN_ENABLED: ${{ inputs.linux_nightly_main_enabled }}
MATRIX_LINUX_NIGHTLY_MAIN_COMMAND_ARGUMENTS: ${{ inputs.linux_nightly_main_arguments_override }}
MATRIX_WINDOWS_COMMAND: "swift test"
MATRIX_WINDOWS_6_0_ENABLED: ${{ inputs.windows_6_0_enabled }}
MATRIX_WINDOWS_6_0_COMMAND_ARGUMENTS: ${{ inputs.windows_6_0_arguments_override }}
MATRIX_WINDOWS_NIGHTLY_NEXT_ENABLED: ${{ inputs.windows_nightly_6_1_enabled && inputs.windows_nightly_next_enabled }}
MATRIX_WINDOWS_NIGHTLY_NEXT_COMMAND_ARGUMENTS: ${{ inputs.windows_nightly_6_1_arguments_override }} ${{ inputs.windows_nightly_next_arguments_override }}
MATRIX_WINDOWS_NIGHTLY_MAIN_ENABLED: ${{ inputs.windows_nightly_main_enabled }}
MATRIX_WINDOWS_NIGHTLY_MAIN_COMMAND_ARGUMENTS: ${{ inputs.windows_nightly_main_arguments_override }}
unit-tests:
name: Unit tests
needs: construct-matrix
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main
with:
name: "Unit tests"
matrix_string: '${{ needs.construct-matrix.outputs.unit-test-matrix }}'