Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Add support for running only affected tests during pull requests #13

Open
4 tasks
jverkoey opened this issue Nov 10, 2017 · 1 comment
Open
4 tasks

Comments

@jverkoey
Copy link
Contributor

jverkoey commented Nov 10, 2017

We should easily be able to do a bazel query to identify which tests are affected during a pull request. This will allow us to only build/test targets that are affected by the PR.

For continuous integration we should still always run every test.

  • Get the list of files that have changed as part of the PR.
  • Run each file through a bazel query invocation.
  • Aggregate the affected targets into a list.
  • Only build/test the affected targets.
@jverkoey
Copy link
Contributor Author

jverkoey commented Apr 5, 2018

The following invocation will run tests for affected files:

    git diff --name-only "$TARGET_BRANCH...$KOKORO_GIT_COMMIT" | \
      while read line ; do bazel query "tests(rdeps(//components/..., $line))" 2>/dev/null ; done | \
      tee /dev/tty | \
      xargs bazel $ACTION --xcode_version $xcode_version $extra_args $verbosity_flags "${POSITIONAL[@]:2}"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant