@@ -32,31 +32,12 @@ jobs:
32
32
id : set-matrix
33
33
run : |
34
34
# 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
38
35
RUNS=$(gh api "repos/$GITHUB_REPOSITORY/commits/main/check-runs" --paginate)
39
36
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")
58
39
echo "creating result matrix."
59
- echo "matrix=$MY_M " >> $GITHUB_OUTPUT
40
+ echo "matrix=$MATRIX " >> $GITHUB_OUTPUT
60
41
61
42
# We need this process step in here, because we have in excess of 256 jobs.
62
43
process :
79
60
strategy :
80
61
fail-fast : false
81
62
matrix :
82
- job : ${{ fromJson(needs.process.outputs.matrix ) }}
63
+ job : ${{ fromJson(needs.process.outputs.jobs ) }}
83
64
runs-on : ubuntu-latest
84
65
permissions :
85
66
contents : read
0 commit comments