[Feature Request]: Move sharded runs over to using --target_pattern_file
Is your feature request related to a problem? Please describe.
The command line for sharded runs can be a bit hard to read due to the concatenation happening. It can also be a bit tedious to find the list of tests being built/run.
Describe the solution you'd like
Bazel supports using a file to pass along a list of targets: https://bazel.build/reference/command-line-reference#build-flag--target_pattern_file. The sharded test & coverage workflows should be updated to output the targets to a file and use this file, instead.
As a bonus, we should also upload the target files to artifacts for each sharded job so that we can easily download them when analyzing failures.
Describe alternatives you've considered
Leaving things as-is, which is also fine. This is just a nice-to-have.
Additional context
This also has the bonus of reminding me and others that this flag exists, and helps a lot when working on large codebase-wide refactors that break a lot of tests (e.g. #5836 and many of the other PRs I've been working on recently). :)
I also first found this flag when reading https://github.com/bazelbuild/bazel/issues/8609. Linking that in case anyone who finds that issue in the future wants to see another integration pathway (once this issue is addressed).
Potential implementers:
- Use the Bazel docs (https://bazel.build/reference/command-line-reference#build-flag--target_pattern_file) as a reference for how the file is used.
- The two workflows that need to be updated to generate and use a file instead of an environment variable:
- https://github.com/oppia/oppia-android/blob/cda4f44e36222fae5fc8672c774cc8c281f97156/.github/workflows/unit_tests.yml#L139
- https://github.com/oppia/oppia-android/blob/cda4f44e36222fae5fc8672c774cc8c281f97156/.github/workflows/code_coverage.yml#L149
- For an example on uploading artifacts (Oppia Android no longer does this, I think, since our uploads were too large and using up a lot of the shared artifacts quota--the text files proposed in this issue are small and shouldn't be an issue):
- https://github.com/oppia/oppia/blob/a5fbb372b7df18faa1a8e8dc77e9d999d7d74849/.github/actions/generate-build-files/action.yml#L46-L53
- If you're unfamiliar with GitHub actions, take a look here: https://docs.github.com/en/actions/about-github-actions/understanding-github-actions.
I think this can be considered a starter issue with the above code pointers.
Thanks a lot for the cross link, very helpful!
I would like to work on this issue.