-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
2 changed files
with
42 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters