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