Skip to content

Commit

Permalink
Improving check to run workflows
Browse files Browse the repository at this point in the history
Aside from checking bazel targets,
we also need to check if there are
any test targets we need to run.

For example, a change in Grid needs
to trigger remote tests in all bindings.
  • Loading branch information
diemol committed Mar 3, 2022
1 parent a5204d4 commit 668d131
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/github-actions/should-workflow-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,19 @@ fi

if [[ " ${bazel_targets[*]} " == *"$BAZEL_TARGET_PREFIX"* ]]; then
echo "::set-output name=run-workflow::true"
echo "Bazel targets found: ${bazel_targets[*]}."
echo "Bazel targets found: ${bazel_targets[*]}"
exit 0
fi

# Now check if we need to run some tests based on this change
# E.g. A change in Grid needs to trigger remote tests in other bindings
tests=$(bazel query \
--keep_going \
--noshow_progress \
"kind(test, rdeps(//..., set(${bazel_targets[*]})))")


if [[ " ${tests[*]} " == *"$BAZEL_TARGET_PREFIX"* ]]; then
echo "::set-output name=run-workflow::true"
echo "Test targets found: ${tests[*]}"
exit 0
fi

0 comments on commit 668d131

Please sign in to comment.