Skip to content

Commit 119e1cd

Browse files
committed
account for coverage setting in prepare-functional matrix
1 parent 6ade809 commit 119e1cd

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

.github/workflows/reusable-testing.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,35 @@ jobs:
342342
id: set-matrix
343343
run: |
344344
if [[ $FILE_EXISTS == 'true' ]]; then
345-
echo "matrix=$(jq -c '.include |= map(select(.wp == "4.9").wp |= "${{ inputs.minimum-wp }}") | .include |= map(select(.php >= "${{ inputs.minimum-php }}"))' <<< $BASE_MATRIX)" >> $GITHUB_OUTPUT
345+
echo "matrix=$(jq \
346+
--argjson with_coverage_flag "${{ inputs.with-coverage }}" \
347+
--arg minimum_php "${{ inputs.minimum-php }}" \
348+
--arg minimum_wp "${{ inputs.minimum-wp }}" \
349+
'
350+
# First, select only the versions that meet all minimum requirements
351+
.include |= (
352+
map(
353+
select(
354+
.php >= $minimum_php
355+
) |
356+
# Next, update the coverage flag on the remaining items
357+
if $with_coverage_flag == false and .coverage == true then
358+
.coverage = false
359+
else
360+
.
361+
end
362+
)
363+
) |
364+
365+
# Reassign WP4.9 to minimum_wp
366+
.include |= (
367+
map(
368+
select(
369+
.wp == "4.9"
370+
).wp |= $minimum_wp
371+
)
372+
)
373+
' <<< "$BASE_MATRIX" )" >> $GITHUB_OUTPUT
346374
else
347375
echo "matrix=" >> $GITHUB_OUTPUT
348376
fi

0 commit comments

Comments
 (0)