ReCirq icon indicating copy to clipboard operation
ReCirq copied to clipboard

Run pytest actions only on recirq subdirectories that were modified by a pull request

Open weinstein opened this issue 2 years ago • 1 comments

On PR events:

  • inspect the files modified by the PR
  • collect the subdirectories containing those files
  • run pytest only on those subdirectories

Most changes which only affect one of the experiments under a directory within recirq/ will trigger pytest on that experiment's subdirectory. However for paths that are likely to affect the entire repo, we'd still pytest everything.

I tested this by creating some PRs against my fork, ex: https://github.com/weinstein/ReCirq/pull/2 and examining the actions that ran for the PR events: https://github.com/weinstein/ReCirq/runs/3930186853 as well as the push event: https://github.com/weinstein/ReCirq/runs/3911613649

With these changes, we'd still run the original action and pytest the entire repo after a PR gets merged. However, this won't actually prevent merging if those tests fail, and github doesn't expose any "pre-merge attempt" events that we could potentially trigger the actions on. One potential workaround would be to require review on all PRs (in addition to the currently required statuses) and trigger the final expensive round of testing on PR review completion.

weinstein avatar Oct 18 '21 18:10 weinstein

With these changes, we'd still run the original action and pytest the entire repo after a PR gets merged. However, this won't actually prevent merging if those tests fail, and github doesn't expose any "pre-merge attempt" events that we could potentially trigger the actions on. One potential workaround would be to require review on all PRs (in addition to the currently required statuses) and trigger the final expensive round of testing on PR review completion.

What if you keep a single test action, which runs affected tests if it's a pull request and all tests otherwise?

losos0 avatar Oct 26 '21 05:10 losos0