@@ -32,31 +32,12 @@ jobs:
3232 id : set-matrix
3333 run : |
3434 # Group the output by platform.
35- curl -L https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux64 -o jq
36- chmod +x jq
37- ./jq --version
3835 RUNS=$(gh api "repos/$GITHUB_REPOSITORY/commits/main/check-runs" --paginate)
3936 echo "checks..."
40- FILTERED=$(./jq -c -r '.check_runs[] | select(.name | endswith("-env")) | { "config": .name, "build_path": .output.text }' <<< "$RUNS")
41- echo "filtered..."
42- ./jq -e . <<< "$FILTERED"
43- FILTERED=$(./jq --slurp -c -r . <<< "$FILTERED")
44- ./jq -e . <<< "$FILTERED"
45- echo "computing groups"
46- ./jq -c '. as $jobs | map(.config | split(".") | first) | unique | map(. as $group | {"platform": $group, "jobs": $jobs | map(select(.config |startswith($group)))})' <<< "$FILTERED"
47- echo $?
48- set -x
49- echo "Lets build groups..."
50- MY_M=$(./jq -c '. as $jobs | map(.config | split(".") | first) | unique | map(. as $group | {"platform": $group, "jobs": $jobs | map(select(.config |startswith($group)))})' <<< "$FILTERED")
51- echo "groups..."
52- if ./jq -e . <<< "$MY_M" > /dev/null 2>&1; then # JSON validation
53- echo "Valid JSON"
54- else
55- echo "Invalid JSON: $MY_M"
56- exit 1 # or handle the error appropriately
57- fi
37+ FILTERED=$(jq -c -r '.check_runs[] | select(.name | endswith("-env")) | { "config": .name, "build_path": .output.text }' <<< "$RUNS")
38+ MATRIX=$(./jq --slurp -c -r '. as $jobs | map(.config | split(".") | first) | unique | map(. as $group | {"platform": $group, "jobs": $jobs | map(select(.config |startswith($group)))})' <<< "$FILTERED")
5839 echo "creating result matrix."
59- echo "matrix=$MY_M " >> $GITHUB_OUTPUT
40+ echo "matrix=$MATRIX " >> $GITHUB_OUTPUT
6041
6142 # We need this process step in here, because we have in excess of 256 jobs.
6243 process :
7960 strategy :
8061 fail-fast : false
8162 matrix :
82- job : ${{ fromJson(needs.process.outputs.matrix ) }}
63+ job : ${{ fromJson(needs.process.outputs.jobs ) }}
8364 runs-on : ubuntu-latest
8465 permissions :
8566 contents : read
0 commit comments