-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only run CI e2e tests on approved PRs #6080
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
It might be nicer to move the e2e tests to a separate workflow file, and maybe also do a single run of e2e tests in the test.yml workflow and a more comprehensive matrix on approval |
Yes, I floated some similar ideas as well. At the moment it's assumed that all the e2e tests are being run every time a PR is updated, and every time a merge to main happens. Lexical is way over its CI budget. As a first step, I'd like to validate that a relatively small and quick change can demonstrate reduction in CI costs. If we can do that, I think further organization and optimization sounds great. |
I suggested the separate workflow file because it would be a smaller logical change since the approval stuff could be floated out to one place instead of N different places |
but maybe my understanding of the schema is a bit off, I haven't tried to do it. looks good either way! |
5ff4054
to
acb1f54
Compare
I agree with this in spirit, but in practice it's gonna slow us down significantly to have to get a stamp before we can see the CI run outcome. Is there a way to make an exception for codeowners or specific users? (i.e., something like: if it's a maintainer, run on submit, otherwise, run on approve.) |
I believe this is because of the budget issue |
I think what would be budget and velocity friendly would be to run a very limited matrix of e2e before approval (but not in draft), e.g. mac chromium or whatever is cheapest, and then do the full suite later on approval or some other condition that doesn't happen on every commit for every contributor. If there was some parameters around how much these things cost and what the budget are the scope could be widened a bit to cover more combinations (e.g. mac+chromium and mac+chromium+collab). We could even consider ditching some things like legacy events altogether unless that's still important enough to worry about. Breaking the build merely by contributing too much isn't something I anticipated 😆 |
There is a way to do that. I looked through recent commits and PRs, and it looks like most of them are created by Meta employees or Lexical collaborators - it would limit the budget impact to exclude maintainers. I think what @etrepum suggested could be a good balance, e.g., you decide one or two e2e suites to run always, and the rest are deferred until PR approval. Later we could try to exclude more PRs (like this one) from running e2e tests at all; that would help allocate more budget to the PRs that benefit most. |
Yea, this is a good idea. |
Once the existing CI workflow is back up and running, I'm happy to keep iterating on feedback until you're happy it doesn't negatively impact development. |
acb1f54
to
3faf0bf
Compare
size-limit report 📦
|
4c16520
to
0caf03e
Compare
I mocked the e2e test workflow to make iterating / reviewing faster and cheaper. PR skips extended tests by default: Added Removed label and updated diff, extended tests don't run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a great approach to me, I think it makes sense (as a follow-up) to add a workflow that automatically adds the label so reviewers don't have to remember to do a second action after approving a PR
.github/workflows/tests-extended.yml
Outdated
|
||
jobs: | ||
e2e-tests: | ||
if: github.repository_owner == 'facebook' && contains(github.event.pull_request.labels.*.name, 'approved') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To bike-shed slightly on the name I would recommend changing the allow label to something like 'extended-tests' or 'e2e-tests' instead of 'approved'. My reasoning behind this is:
- We may also want to have a deny label like 'no-extended-tests' or 'no-e2e-tests' for PRs that a reviewer knows won't benefit from the full suite
- A contributor with sufficient privileges working on something that they know would benefit from the full suite could self-label without looking like they are rubber-stamping their own PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Renamed to 'extended-tests'.
An alternative / addition to a "deny label" would be to expand on the paths-ignore
to help automatically exclude PRs that only change files like READMEs, etc., which don't need functional testing.
I was also looking at the patch Dominic introduced to run e2e tests with beforeinput disabled - those of you more familiar with the status of "legacy events" will be better placed to determine if they still need as much testing.
.github/workflows/call-e2e-test.yml
Outdated
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: npm | ||
- name: Mock e2e test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We of course need to un-mock before merge but great idea to make this quick, cheap and easy to verify!
Avoid running the entire suite of (expensive) e2e tests on every PR that is opened or updated. Only run if PR is approved. Reference: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-when-a-pull-request-is-approved
0caf03e
to
58920a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense (as a follow-up) to add a workflow that automatically adds the label so reviewers don't have to remember to do a second action after approving a PR
Makes sense. This lgtm now.
Thanks for working on this, @necolas
We're waiting on a commit to unmock before we merge, right? |
58920a3
to
93a58c3
Compare
Mock removed.
No worries. The Lexical OSS project has some cool features I learnt about too. Very impressed with what you've all done here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @necolas for optimising the workflows for budget control.
Avoid running the entire suite of (expensive) e2e tests on every PR that is opened or updated. Only run if PR is approved.
Reference: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-when-a-pull-request-is-approved