From d3e8c8c67d11db89607bb8dbff098f8b12d946de Mon Sep 17 00:00:00 2001 From: Rick Newton-Rogers Date: Thu, 5 Dec 2024 08:23:51 +0000 Subject: [PATCH 1/4] Introduce JSON matrix workflow (#3013) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce and adopt a new method for defining test matrices, `swift_test_matrix.yml`. ⚠️ Any external adopters of the unit tests, Cxx interop and benchmarks workflows are automatically opted in to use the new infrastructure. ### Motivation: * The current matrix workflow has the limitation that it only supports pre-defined sets of variables which are explored in the test matrix. At the moment this is a pre-defined set of Swift versions on Linux and Windows. * Adding more means hard-coding them at multiple levels of the workflow hierarchy. * Currently skipped Windows matrix jobs show up as successes in the GitHub UI leading to a misleading impression of good coverage. ### Modifications: Introduce and adopt a new method for defining test matrices, `swift_test_matrix.yml`. The new method is based around the approach of defining the test matrix via a JSON object which may be supplied via an input string from another workflow or from a file on-disk in a repository. Taking this approach means that we have the ability to add new targets to the matrix simply by adding new elements to the JSON array, increasing flexibility and the scope for future growth. The unit tests, Cxx interop and benchmarks workflows are all modified to use the new approach, this opts-in all downstream adopters. This should be transparent to all downstream adopters. In order to unify the Linux and Windows jobs I removed the use of the `container:` GitHub Actions affordance in the Linux jobs which transparently means all steps are executed within the nested container. Instead we must manually call in to the docker container which complicates scripting a little. I tested to see if doing this slowed down the jobs (perhaps GitHub was caching the docker images more intelligently) but it does not. This approach follows the pattern of @FranzBusch 's open PR https://github.com/apple/swift-nio/pull/2942 ### Result: * More flexible test matrix definitions * No more false-passes for disabled Windows targets --- .github/workflows/benchmarks.yml | 34 ++++-- .github/workflows/cxx_interop.yml | 40 +++++-- .github/workflows/main.yml | 29 ++++- .github/workflows/pull_request.yml | 33 +++-- .github/workflows/swift_test_matrix.yml | 93 ++++++++++++++ .github/workflows/unit_tests.yml | 54 ++++++--- scripts/generate_matrix.sh | 153 ++++++++++++++++++++++++ 7 files changed, 380 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/swift_test_matrix.yml create mode 100755 scripts/generate_matrix.sh diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 2b2e4eb38b..f039ba7c55 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -45,18 +45,32 @@ on: default: false jobs: + construct-matrix: + name: Construct Benchmarks matrix + runs-on: ubuntu-latest + outputs: + benchmarks-matrix: '${{ steps.generate-matrix.outputs.benchmarks-matrix }}' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + - id: generate-matrix + run: echo "benchmarks-matrix=$(./scripts/generate_matrix.sh)" >> "$GITHUB_OUTPUT" + env: + MATRIX_LINUX_COMMAND: "swift package --package-path ${{ inputs.benchmark_package_path }} ${{ inputs.swift_package_arguments }} benchmark baseline check --check-absolute-path ${{ inputs.benchmark_package_path }}/Thresholds/${SWIFT_VERSION}/" + MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q libjemalloc-dev" + MATRIX_LINUX_5_9_ENABLED: ${{ inputs.linux_5_9_enabled }} + MATRIX_LINUX_5_10_ENABLED: ${{ inputs.linux_5_10_enabled }} + MATRIX_LINUX_6_0_ENABLED: ${{ inputs.linux_6_0_enabled }} + MATRIX_LINUX_NIGHTLY_6_0_ENABLED: ${{ inputs.linux_nightly_6_0_enabled }} + MATRIX_LINUX_NIGHTLY_MAIN_ENABLED: ${{ inputs.linux_nightly_main_enabled }} + benchmarks: name: Benchmarks + needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@matrix_file # TODO: replace with @main with: name: "Benchmarks" - matrix_linux_command: "apt-get update -y -q && apt-get install -y -q libjemalloc-dev && swift package --package-path ${{ inputs.benchmark_package_path }} ${{ inputs.swift_package_arguments }} benchmark baseline check --check-absolute-path ${{ inputs.benchmark_package_path }}/Thresholds/${SWIFT_VERSION}/" - matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }} - matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }} - matrix_linux_6_0_enabled: ${{ inputs.linux_6_0_enabled }} - matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }} - matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }} - matrix_windows_6_0_enabled: ${{ inputs.windows_6_0_enabled }} - matrix_windows_nightly_6_0_enabled: ${{ inputs.windows_nightly_6_0_enabled }} - matrix_windows_nightly_main_enabled: ${{ inputs.windows_nightly_main_enabled }} + matrix_string: '${{ needs.construct-matrix.outputs.benchmarks-matrix }}' diff --git a/.github/workflows/cxx_interop.yml b/.github/workflows/cxx_interop.yml index 3e66426076..545d596380 100644 --- a/.github/workflows/cxx_interop.yml +++ b/.github/workflows/cxx_interop.yml @@ -26,30 +26,44 @@ on: windows_6_0_enabled: type: boolean - description: "Boolean to enable the Windows 6.0 Swift version matrix job. Defaults to true." + description: "Boolean to enable the Windows 6.0 Swift version matrix job. Defaults to false. Currently has no effect!" # TODO: implement Windows Cxx compat checking default: false windows_nightly_6_0_enabled: type: boolean - description: "Boolean to enable the Windows nightly 6.0 Swift version matrix job. Defaults to true." + description: "Boolean to enable the Windows nightly 6.0 Swift version matrix job. Defaults to false. Currently has no effect!" # TODO: implement Windows Cxx compat checking default: false windows_nightly_main_enabled: type: boolean - description: "Boolean to enable the Windows nightly main Swift version matrix job. Defaults to true." + description: "Boolean to enable the Windows nightly main Swift version matrix job. Defaults to false. Currently has no effect!" # TODO: implement Windows Cxx compat checking default: false jobs: + construct-matrix: + name: Construct Cxx interop matrix + runs-on: ubuntu-latest + outputs: + cxx-interop-matrix: '${{ steps.generate-matrix.outputs.cxx-interop-matrix }}' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + - id: generate-matrix + run: echo "cxx-interop-matrix=$(./scripts/generate_matrix.sh)" >> "$GITHUB_OUTPUT" + env: + MATRIX_LINUX_COMMAND: "curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-cxx-interop-compatibility.sh | bash" + MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q curl jq" + MATRIX_LINUX_5_9_ENABLED: ${{ inputs.linux_5_9_enabled }} + MATRIX_LINUX_5_10_ENABLED: ${{ inputs.linux_5_10_enabled }} + MATRIX_LINUX_6_0_ENABLED: ${{ inputs.linux_6_0_enabled }} + MATRIX_LINUX_NIGHTLY_6_0_ENABLED: ${{ inputs.linux_nightly_6_0_enabled }} + MATRIX_LINUX_NIGHTLY_MAIN_ENABLED: ${{ inputs.linux_nightly_main_enabled }} + cxx-interop: name: Cxx interop + needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@matrix_file # TODO: replace with @main with: name: "Cxx interop" - matrix_linux_command: "apt-get update -y -q && apt-get install -y -q jq && curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-cxx-interop-compatibility.sh | bash" - matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }} - matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }} - matrix_linux_6_0_enabled: ${{ inputs.linux_6_0_enabled }} - matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }} - matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }} - matrix_windows_6_0_enabled: ${{ inputs.windows_6_0_enabled }} - matrix_windows_nightly_6_0_enabled: ${{ inputs.windows_nightly_6_0_enabled }} - matrix_windows_nightly_main_enabled: ${{ inputs.windows_nightly_main_enabled }} + matrix_string: '${{ needs.construct-matrix.outputs.cxx-interop-matrix }}' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f6fd16711c..b7ff327793 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: unit-tests: name: Unit tests # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/unit_tests.yml@main + uses: apple/swift-nio/.github/workflows/unit_tests.yml@matrix_file # TODO: replace with @main with: linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" @@ -21,19 +21,36 @@ jobs: cxx-interop: name: Cxx interop # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main + uses: apple/swift-nio/.github/workflows/cxx_interop.yml@matrix_file # TODO: replace with @main benchmarks: name: Benchmarks # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/benchmarks.yml@main + uses: apple/swift-nio/.github/workflows/benchmarks.yml@matrix_file # TODO: replace with @main with: benchmark_package_path: "Benchmarks" + construct-integration-test-matrix: + name: Construct integration test matrix + runs-on: ubuntu-latest + outputs: + integration-test-matrix: '${{ steps.generate-matrix.outputs.integration-test-matrix }}' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + - id: generate-matrix + run: echo "integration-test-matrix=$(./scripts/generate_matrix.sh)" >> "$GITHUB_OUTPUT" + env: + MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq" + MATRIX_LINUX_COMMAND: "./scripts/integration_tests.sh" + integration-tests: - name: Integration Tests + name: Integration tests + needs: construct-integration-test-matrix # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@matrix_file # TODO: replace with @main with: name: "Integration tests" - matrix_linux_command: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq && ./scripts/integration_tests.sh" + matrix_string: '${{ needs.construct-integration-test-matrix.outputs.integration-test-matrix }}' diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 1e5a3b7340..b20fa6ff5a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -14,33 +14,50 @@ jobs: unit-tests: name: Unit tests # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/unit_tests.yml@main + uses: apple/swift-nio/.github/workflows/unit_tests.yml@matrix_file # TODO: replace with @main with: linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" - linux_6_0_arguments_override: "--explicit-target-dependency-import-check error" - linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error" + linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" + linux_nightly_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error" benchmarks: name: Benchmarks # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/benchmarks.yml@main + uses: apple/swift-nio/.github/workflows/benchmarks.yml@matrix_file # TODO: replace with @main with: benchmark_package_path: "Benchmarks" cxx-interop: name: Cxx interop # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main + uses: apple/swift-nio/.github/workflows/cxx_interop.yml@matrix_file # TODO: replace with @main + + construct-integration-test-matrix: + name: Construct integration test matrix + runs-on: ubuntu-latest + outputs: + integration-test-matrix: '${{ steps.generate-matrix.outputs.integration-test-matrix }}' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + - id: generate-matrix + run: echo "integration-test-matrix=$(./scripts/generate_matrix.sh)" >> "$GITHUB_OUTPUT" + env: + MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq" + MATRIX_LINUX_COMMAND: "./scripts/integration_tests.sh" integration-tests: - name: Integration Tests + name: Integration tests + needs: construct-integration-test-matrix # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@matrix_file # TODO: replace with @main with: name: "Integration tests" - matrix_linux_command: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq && ./scripts/integration_tests.sh" + matrix_string: '${{ needs.construct-integration-test-matrix.outputs.integration-test-matrix }}' vsock-tests: name: Vsock tests diff --git a/.github/workflows/swift_test_matrix.yml b/.github/workflows/swift_test_matrix.yml new file mode 100644 index 0000000000..675bf09157 --- /dev/null +++ b/.github/workflows/swift_test_matrix.yml @@ -0,0 +1,93 @@ +name: Matrix + +on: + workflow_call: + inputs: + name: + type: string + description: "The name of the workflow used for the concurrency group." + required: true + matrix_path: + type: string + description: "The path of the test matrix definition." + default: "" + matrix_string: + type: string + description: "The test matrix definition." + default: "" + +# We will cancel previously triggered workflow runs +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.name }} + cancel-in-progress: true + +jobs: + generate-matrix: + name: Prepare matrices + runs-on: ubuntu-latest + outputs: + swift-matrix: ${{ steps.load-matrix.outputs.swift-matrix }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Mark the workspace as safe + # https://github.com/actions/checkout/issues/766 + run: git config --global --add safe.directory ${GITHUB_WORKSPACE} + - id: load-matrix + run: | + if [ -n '${{ inputs.matrix_string }}' ]; then + printf "swift-matrix=%s" "$(echo '${{ inputs.matrix_string }}' | jq -c '.')" >> "$GITHUB_OUTPUT" + else + printf "swift-matrix=%s" "$(jq -c '.' ${{ inputs.matrix_path }})" >> "$GITHUB_OUTPUT" + fi + + execute-matrix: + name: ${{ matrix.swift.platform }} (${{ matrix.swift.name }}) + needs: generate-matrix + runs-on: ${{ matrix.swift.runner }} + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.generate-matrix.outputs.swift-matrix) }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + submodules: true + - name: Pull Docker image + run: docker pull ${{ matrix.swift.image }} + - name: Run matrix job + if: ${{ matrix.swift.platform != 'Windows' }} + run: | + if [[ -n "${{ matrix.swift.setup_command }}" ]]; then + setup_command_expression="${{ matrix.swift.setup_command }} &&" + else + setup_command_expression="" + fi + workspace="/$(basename ${{ github.workspace }})" + docker run -v ${{ github.workspace }}:"$workspace" \ + -w "$workspace" \ + -e SWIFT_VERSION="${{ matrix.swift.swift_version }}" \ + -e setup_command_expression="$setup_command_expression" \ + -e workspace="$workspace" \ + ${{ matrix.swift.image }} \ + bash -c "swift --version && git config --global --add safe.directory \"$workspace\" && $setup_command_expression ${{ matrix.swift.command }} ${{ matrix.swift.command_arguments }}" + - name: Run matrix job (Windows) + if: ${{ matrix.swift.platform == 'Windows' }} + run: | + if (-not [string]::IsNullOrEmpty("${{ matrix.swift.setup_command }}")) { + $setup_command_expression = "${{ matrix.swift.setup_command }} &" + } else { + $setup_command_expression = "" + } + $workspace = "C:\" + (Split-Path ${{ github.workspace }} -Leaf) + docker run -v ${{ github.workspace }}:$($workspace) ` + -w $($workspace) ` + -e SWIFT_VERSION="${{ matrix.swift.swift_version }}" ` + -e setup_command_expression=%setup_command_expression% ` + ${{ matrix.swift.image }} ` + cmd /s /c "swift --version & powershell Invoke-Expression ""$($setup_command_expression) ${{ matrix.swift.command }} ${{ matrix.swift.command_arguments }}""" + env: + SWIFT_VERSION: ${{ matrix.swift.swift_version }} diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 8a70518bb6..a0be8a1076 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -70,27 +70,43 @@ on: 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=$(./scripts/generate_matrix.sh)" >> "$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_6_0_ENABLED: ${{ inputs.linux_nightly_6_0_enabled }} + MATRIX_LINUX_NIGHTLY_6_0_COMMAND_ARGUMENTS: ${{ inputs.linux_nightly_6_0_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_6_0_ENABLED: ${{ inputs.windows_nightly_6_0_enabled }} + MATRIX_WINDOWS_NIGHTLY_6_0_COMMAND_ARGUMENTS: ${{ inputs.windows_nightly_6_0_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_matrix.yml@main + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@matrix_file # TODO: replace with @main with: name: "Unit tests" - matrix_linux_command: "swift test" - matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }} - matrix_linux_5_9_command_override: "swift test ${{ inputs.linux_5_9_arguments_override }}" - matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }} - matrix_linux_5_10_command_override: "swift test ${{ inputs.linux_5_10_arguments_override }}" - matrix_linux_6_0_enabled: ${{ inputs.linux_6_0_enabled }} - matrix_linux_6_0_command_override: "swift test ${{ inputs.linux_6_0_arguments_override }}" - matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }} - matrix_linux_nightly_6_0_command_override: "swift test ${{ inputs.linux_nightly_6_0_arguments_override }}" - matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }} - matrix_linux_nightly_main_command_override: "swift test ${{ 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_override: "swift test ${{ inputs.windows_6_0_arguments_override }}" - matrix_windows_nightly_6_0_enabled: ${{ inputs.windows_nightly_6_0_enabled }} - matrix_windows_nightly_6_0_command_override: "swift test ${{ inputs.windows_nightly_6_0_arguments_override }}" - matrix_windows_nightly_main_enabled: ${{ inputs.windows_nightly_main_enabled }} - matrix_windows_nightly_main_command_override: "swift test ${{ inputs.windows_nightly_main_arguments_override }}" + matrix_string: '${{ needs.construct-matrix.outputs.unit-test-matrix }}' diff --git a/scripts/generate_matrix.sh b/scripts/generate_matrix.sh new file mode 100755 index 0000000000..dbab4f69a3 --- /dev/null +++ b/scripts/generate_matrix.sh @@ -0,0 +1,153 @@ +#!/bin/bash +##===----------------------------------------------------------------------===## +## +## This source file is part of the SwiftNIO open source project +## +## Copyright (c) 2024 Apple Inc. and the SwiftNIO project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.txt for the list of SwiftNIO project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +# Parameters +linux_command="$MATRIX_LINUX_COMMAND" # required if any Linux pipeline is enabled +linux_setup_command="$MATRIX_LINUX_SETUP_COMMAND" +linux_5_9_enabled="${MATRIX_LINUX_5_9_ENABLED:=true}" +linux_5_9_command_arguments="$MATRIX_LINUX_5_9_COMMAND_ARGUMENTS" +linux_5_10_enabled="${MATRIX_LINUX_5_10_ENABLED:=true}" +linux_5_10_command_arguments="$MATRIX_LINUX_5_10_COMMAND_ARGUMENTS" +linux_6_0_enabled="${MATRIX_LINUX_6_0_ENABLED:=true}" +linux_6_0_command_arguments="$MATRIX_LINUX_6_0_COMMAND_ARGUMENTS" +linux_nightly_6_0_enabled="${MATRIX_LINUX_NIGHTLY_6_0_ENABLED:=true}" +linux_nightly_6_0_command_arguments="$MATRIX_LINUX_NIGHTLY_6_0_COMMAND_ARGUMENTS" +linux_nightly_main_enabled="${MATRIX_LINUX_NIGHTLY_MAIN_ENABLED:=true}" +linux_nightly_main_command_arguments="$MATRIX_LINUX_NIGHTLY_MAIN_COMMAND_ARGUMENTS" + +windows_command="$MATRIX_WINDOWS_COMMAND" # required if any Windows pipeline is enabled +windows_setup_command="$MATRIX_WINDOWS_SETUP_COMMAND" +windows_6_0_enabled="${MATRIX_WINDOWS_6_0_ENABLED:=false}" +windows_6_0_command_arguments="$MATRIX_WINDOWS_6_0_COMMAND_ARGUMENTS" +windows_nightly_6_0_enabled="${MATRIX_WINDOWS_NIGHTLY_6_0_ENABLED:=false}" +windows_nightly_6_0_command_arguments="$MATRIX_WINDOWS_NIGHTLY_6_0_COMMAND_ARGUMENTS" +windows_nightly_main_enabled="${MATRIX_WINDOWS_NIGHTLY_MAIN_ENABLED:=false}" +windows_nightly_main_command_arguments="$MATRIX_WINDOWS_NIGHTLY_MAIN_COMMAND_ARGUMENTS" + +# Defaults +linux_runner="ubuntu-latest" +linux_5_9_container_image="swift:5.9-jammy" +linux_5_10_container_image="swift:5.10-jammy" +linux_6_0_container_image="swift:6.0-jammy" +linux_nightly_6_0_container_image="swiftlang/swift:nightly-6.0-jammy" +linux_nightly_main_container_image="swiftlang/swift:nightly-main-jammy" + +windows_6_0_runner="windows-2022" +windows_6_0_container_image="swift:6.0-windowsservercore-ltsc2022" +windows_nightly_6_0_runner="windows-2019" +windows_nightly_6_0_container_image="swiftlang/swift:nightly-6.0-windowsservercore-1809" +windows_nightly_main_runner="windows-2019" +windows_nightly_main_container_image="swiftlang/swift:nightly-main-windowsservercore-1809" + +# Create matrix from inputs +matrix='{"swift": []}' + +## Linux +if [[ "$linux_5_9_enabled" == "true" || "$linux_5_10_enabled" == "true" || "$linux_6_0_enabled" == "true" || \ + "$linux_nightly_6_0_enabled" == "true" || "$linux_nightly_main_enabled" == "true" ]]; then + if [[ -z "$linux_command" ]]; then + echo "No linux command defined"; exit 1 + fi +fi + + +if [[ "$linux_5_9_enabled" == "true" ]]; then + matrix=$(echo "$matrix" | jq -c \ + --arg setup_command "$linux_setup_command" \ + --arg command "$linux_command" \ + --arg command_arguments "$linux_5_9_command_arguments" \ + --arg container_image "$linux_5_9_container_image" \ + --arg runner "$linux_runner" \ + '.swift[.swift| length] |= . + { "name": "5.9", "image": $container_image, "swift_version": "5.9", "platform": "Linux", "command": $command, "command_arguments": $command_arguments, "setup_command": $setup_command, "runner": $runner}') +fi + +if [[ "$linux_5_10_enabled" == "true" ]]; then + matrix=$(echo "$matrix" | jq -c \ + --arg setup_command "$linux_setup_command" \ + --arg command "$linux_command" \ + --arg command_arguments "$linux_5_10_command_arguments" \ + --arg container_image "$linux_5_10_container_image" \ + --arg runner "$linux_runner" \ + '.swift[.swift| length] |= . + { "name": "5.10", "image": $container_image, "swift_version": "5.10", "platform": "Linux", "command": $command, "command_arguments": $command_arguments, "setup_command": $setup_command, "runner": $runner}') +fi + +if [[ "$linux_6_0_enabled" == "true" ]]; then + matrix=$(echo "$matrix" | jq -c \ + --arg setup_command "$linux_setup_command" \ + --arg command "$linux_command" \ + --arg command_arguments "$linux_6_0_command_arguments" \ + --arg container_image "$linux_6_0_container_image" \ + --arg runner "$linux_runner" \ + '.swift[.swift| length] |= . + { "name": "6.0", "image": $container_image, "swift_version": "6.0", "platform": "Linux", "command": $command, "command_arguments": $command_arguments, "setup_command": $setup_command, "runner": $runner}') +fi + +if [[ "$linux_nightly_6_0_enabled" == "true" ]]; then + matrix=$(echo "$matrix" | jq -c \ + --arg setup_command "$linux_setup_command" \ + --arg command "$linux_command" \ + --arg command_arguments "$linux_nightly_6_0_command_arguments" \ + --arg container_image "$linux_nightly_6_0_container_image" \ + --arg runner "$linux_runner" \ + '.swift[.swift| length] |= . + { "name": "nightly-6.0", "image": $container_image, "swift_version": "nightly-6.0", "platform": "Linux", "command": $command, "command_arguments": $command_arguments, "setup_command": $setup_command, "runner": $runner}') +fi + +if [[ "$linux_nightly_main_enabled" == "true" ]]; then + matrix=$(echo "$matrix" | jq -c \ + --arg setup_command "$linux_setup_command" \ + --arg command "$linux_command" \ + --arg command_arguments "$linux_nightly_main_command_arguments" \ + --arg container_image "$linux_nightly_main_container_image" \ + --arg runner "$linux_runner" \ + '.swift[.swift| length] |= . + { "name": "nightly-main", "image": $container_image, "swift_version": "nightly-main", "platform": "Linux", "command": $command, "command_arguments": $command_arguments, "setup_command": $setup_command, "runner": $runner}') +fi + +## Windows +if [[ "$windows_6_0_enabled" == "true" || "$windows_nightly_6_0_enabled" == "true" || "$windows_nightly_main_enabled" == "true" ]]; then + if [[ -z "$windows_command" ]]; then + echo "No windows command defined"; exit 1 + fi +fi + +if [[ "$windows_6_0_enabled" == "true" ]]; then + matrix=$(echo "$matrix" | jq -c \ + --arg setup_command "$windows_setup_command" \ + --arg command "$windows_command" \ + --arg command_arguments "$windows_6_0_command_arguments" \ + --arg container_image "$windows_6_0_container_image" \ + --arg runner "$windows_6_0_runner" \ + '.swift[.swift| length] |= . + { "name": "6.0", "image": $container_image, "swift_version": "6.0", "platform": "Windows", "command": $command, "command_arguments": $command_arguments, "setup_command": $setup_command, "runner": $runner }') +fi + +if [[ "$windows_nightly_6_0_enabled" == "true" ]]; then + matrix=$(echo "$matrix" | jq -c \ + --arg setup_command "$windows_setup_command" \ + --arg command "$windows_command" \ + --arg command_arguments "$windows_nightly_6_0_command_arguments" \ + --arg container_image "$windows_nightly_6_0_container_image" \ + --arg runner "$windows_nightly_6_0_runner" \ + '.swift[.swift| length] |= . + { "name": "nightly-6.0", "image": $container_image, "swift_version": "nightly-6.0", "platform": "Windows", "command": $command, "command_arguments": $command_arguments, "setup_command": $setup_command, "runner": $runner }') +fi + +if [[ "$windows_nightly_main_enabled" == "true" ]]; then + matrix=$(echo "$matrix" | jq -c \ + --arg setup_command "$windows_setup_command" \ + --arg command "$windows_command" \ + --arg command_arguments "$windows_nightly_main_command_arguments" \ + --arg container_image "$windows_nightly_main_container_image" \ + --arg runner "$windows_nightly_main_runner" \ + '.swift[.swift| length] |= . + { "name": "nightly-main", "image": $container_image, "swift_version": "nightly-main", "platform": "Windows", "command": $command, "command_arguments": $command_arguments, "setup_command": $setup_command, "runner": $runner }') +fi + +echo "$matrix" | jq -c \ No newline at end of file From 692cf0a7b82ae1d669cf6ca1b8c7a1f83650a688 Mon Sep 17 00:00:00 2001 From: Rick Newton-Rogers Date: Thu, 5 Dec 2024 08:47:27 +0000 Subject: [PATCH 2/4] Matrix workflows refer to main branch (#3016) Matrix workflows refer to main branch ### Motivation: Now that the workflow files are committed we can refer to them on the main branch ### Modifications: Replace @matrix_file with @main ### Result: More stable references in workflows. --- .github/workflows/benchmarks.yml | 2 +- .github/workflows/cxx_interop.yml | 2 +- .github/workflows/main.yml | 8 ++++---- .github/workflows/pull_request.yml | 8 ++++---- .github/workflows/unit_tests.yml | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index f039ba7c55..87c22373eb 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -70,7 +70,7 @@ jobs: name: Benchmarks needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Benchmarks" matrix_string: '${{ needs.construct-matrix.outputs.benchmarks-matrix }}' diff --git a/.github/workflows/cxx_interop.yml b/.github/workflows/cxx_interop.yml index 545d596380..95e3b872ea 100644 --- a/.github/workflows/cxx_interop.yml +++ b/.github/workflows/cxx_interop.yml @@ -63,7 +63,7 @@ jobs: name: Cxx interop needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Cxx interop" matrix_string: '${{ needs.construct-matrix.outputs.cxx-interop-matrix }}' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b7ff327793..d578891140 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: unit-tests: name: Unit tests # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/unit_tests.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/unit_tests.yml@main with: linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" @@ -21,12 +21,12 @@ jobs: cxx-interop: name: Cxx interop # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/cxx_interop.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main benchmarks: name: Benchmarks # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/benchmarks.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/benchmarks.yml@main with: benchmark_package_path: "Benchmarks" @@ -50,7 +50,7 @@ jobs: name: Integration tests needs: construct-integration-test-matrix # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Integration tests" matrix_string: '${{ needs.construct-integration-test-matrix.outputs.integration-test-matrix }}' diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index b20fa6ff5a..2ad5d6c365 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -14,7 +14,7 @@ jobs: unit-tests: name: Unit tests # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/unit_tests.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/unit_tests.yml@main with: linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" @@ -25,14 +25,14 @@ jobs: benchmarks: name: Benchmarks # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/benchmarks.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/benchmarks.yml@main with: benchmark_package_path: "Benchmarks" cxx-interop: name: Cxx interop # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/cxx_interop.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main construct-integration-test-matrix: name: Construct integration test matrix @@ -54,7 +54,7 @@ jobs: name: Integration tests needs: construct-integration-test-matrix # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Integration tests" matrix_string: '${{ needs.construct-integration-test-matrix.outputs.integration-test-matrix }}' diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index a0be8a1076..2b7a82cc64 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -106,7 +106,7 @@ jobs: name: Unit tests needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@matrix_file # TODO: replace with @main + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Unit tests" matrix_string: '${{ needs.construct-matrix.outputs.unit-test-matrix }}' From 234ea1051fec6a2c8ac312e77d4313ee1e134033 Mon Sep 17 00:00:00 2001 From: Rick Newton-Rogers Date: Thu, 5 Dec 2024 09:22:20 +0000 Subject: [PATCH 3/4] Re-usable workflows curl scripts (#3017) Re-usable workflows curl scripts ### Motivation: Other workflows re-use the NIO workflows they don't do a full git checkout so they don't have access to the scripts, we need to curl them. ### Modifications: curl the scripts ### Result: Downstream repositories should be able to re-use these workflows --- .github/workflows/benchmarks.yml | 2 +- .github/workflows/cxx_interop.yml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/pull_request.yml | 2 +- .github/workflows/unit_tests.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 87c22373eb..4fd97e040d 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -56,7 +56,7 @@ jobs: with: persist-credentials: false - id: generate-matrix - run: echo "benchmarks-matrix=$(./scripts/generate_matrix.sh)" >> "$GITHUB_OUTPUT" + run: echo "benchmarks-matrix=$(curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT" env: MATRIX_LINUX_COMMAND: "swift package --package-path ${{ inputs.benchmark_package_path }} ${{ inputs.swift_package_arguments }} benchmark baseline check --check-absolute-path ${{ inputs.benchmark_package_path }}/Thresholds/${SWIFT_VERSION}/" MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q libjemalloc-dev" diff --git a/.github/workflows/cxx_interop.yml b/.github/workflows/cxx_interop.yml index 95e3b872ea..3e0dda32e2 100644 --- a/.github/workflows/cxx_interop.yml +++ b/.github/workflows/cxx_interop.yml @@ -49,7 +49,7 @@ jobs: with: persist-credentials: false - id: generate-matrix - run: echo "cxx-interop-matrix=$(./scripts/generate_matrix.sh)" >> "$GITHUB_OUTPUT" + run: echo "cxx-interop-matrix=$(curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT" env: MATRIX_LINUX_COMMAND: "curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-cxx-interop-compatibility.sh | bash" MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q curl jq" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d578891140..71ced6aa14 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: with: persist-credentials: false - id: generate-matrix - run: echo "integration-test-matrix=$(./scripts/generate_matrix.sh)" >> "$GITHUB_OUTPUT" + run: echo "integration-test-matrix=$(curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT" env: MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq" MATRIX_LINUX_COMMAND: "./scripts/integration_tests.sh" diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 2ad5d6c365..0336d05c6f 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -45,7 +45,7 @@ jobs: with: persist-credentials: false - id: generate-matrix - run: echo "integration-test-matrix=$(./scripts/generate_matrix.sh)" >> "$GITHUB_OUTPUT" + run: echo "integration-test-matrix=$(curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT" env: MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq" MATRIX_LINUX_COMMAND: "./scripts/integration_tests.sh" diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 2b7a82cc64..8d064fec5f 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -81,7 +81,7 @@ jobs: with: persist-credentials: false - id: generate-matrix - run: echo "unit-test-matrix=$(./scripts/generate_matrix.sh)" >> "$GITHUB_OUTPUT" + 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 }} From 74f767454f648a43176f0161784557898dcb2d7a Mon Sep 17 00:00:00 2001 From: Rick Newton-Rogers Date: Thu, 5 Dec 2024 15:03:53 +0000 Subject: [PATCH 4/4] GHA: Separate matrix input handling (#3018) ### Motivation: The new test matrix workflow is quite verbose in the most common case, unit tests, outputting two workflow entries for handling and preparing the matrix inputs. In addition to this, it appeared that when running in `act` the matrix preparation step would run multiple times. ### Modifications: * Prioritize the current most common case, string inputs, and skip the matrix preparation step in this case reducing the number of workflows run. * Separate the path for loading the JSON matrix from a file into its own workflow. ### Result: * Less noise in the output * More reliable and efficient local matrix runs --- .github/workflows/swift_load_test_matrix.yml | 40 ++++++++++++++++++++ .github/workflows/swift_test_matrix.yml | 30 +-------------- 2 files changed, 42 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/swift_load_test_matrix.yml diff --git a/.github/workflows/swift_load_test_matrix.yml b/.github/workflows/swift_load_test_matrix.yml new file mode 100644 index 0000000000..f0c34c2da5 --- /dev/null +++ b/.github/workflows/swift_load_test_matrix.yml @@ -0,0 +1,40 @@ +name: Matrix Load + +on: + workflow_call: + inputs: + name: + type: string + description: "The name of the workflow used for the concurrency group." + required: true + matrix_path: + type: string + description: "The path of the test matrix definition." + default: "" + +jobs: + load-matrix: + name: Prepare matrices + runs-on: ubuntu-latest + outputs: + swift-matrix: ${{ steps.load-matrix.outputs.swift-matrix }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Mark the workspace as safe + # https://github.com/actions/checkout/issues/766 + run: git config --global --add safe.directory ${GITHUB_WORKSPACE} + - id: load-matrix + run: | + printf "swift-matrix=%s" "$(jq -c '.' ${{ inputs.matrix_path }})" >> "$GITHUB_OUTPUT" + + execute-matrix: + name: Execute matrix + needs: load-matrix + # Workaround https://github.com/nektos/act/issues/1875 + uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main + with: + name: ${{ inputs.name }} + matrix_string: '${{ needs.load-matrix.outputs.swift-matrix }}' diff --git a/.github/workflows/swift_test_matrix.yml b/.github/workflows/swift_test_matrix.yml index 675bf09157..cec7fd70f5 100644 --- a/.github/workflows/swift_test_matrix.yml +++ b/.github/workflows/swift_test_matrix.yml @@ -7,14 +7,10 @@ on: type: string description: "The name of the workflow used for the concurrency group." required: true - matrix_path: - type: string - description: "The path of the test matrix definition." - default: "" matrix_string: type: string description: "The test matrix definition." - default: "" + required: true # We will cancel previously triggered workflow runs concurrency: @@ -22,34 +18,12 @@ concurrency: cancel-in-progress: true jobs: - generate-matrix: - name: Prepare matrices - runs-on: ubuntu-latest - outputs: - swift-matrix: ${{ steps.load-matrix.outputs.swift-matrix }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Mark the workspace as safe - # https://github.com/actions/checkout/issues/766 - run: git config --global --add safe.directory ${GITHUB_WORKSPACE} - - id: load-matrix - run: | - if [ -n '${{ inputs.matrix_string }}' ]; then - printf "swift-matrix=%s" "$(echo '${{ inputs.matrix_string }}' | jq -c '.')" >> "$GITHUB_OUTPUT" - else - printf "swift-matrix=%s" "$(jq -c '.' ${{ inputs.matrix_path }})" >> "$GITHUB_OUTPUT" - fi - execute-matrix: name: ${{ matrix.swift.platform }} (${{ matrix.swift.name }}) - needs: generate-matrix runs-on: ${{ matrix.swift.runner }} strategy: fail-fast: false - matrix: ${{ fromJson(needs.generate-matrix.outputs.swift-matrix) }} + matrix: ${{ fromJson(inputs.matrix_string) }} steps: - name: Checkout repository uses: actions/checkout@v4