Skip to content
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

CI: Make PRs not run tests twice on each commit #1100

Closed
ValarDragon opened this issue Mar 15, 2022 · 2 comments · Fixed by #1114
Closed

CI: Make PRs not run tests twice on each commit #1100

ValarDragon opened this issue Mar 15, 2022 · 2 comments · Fixed by #1114
Assignees

Comments

@ValarDragon
Copy link
Member

Right now CI runs tests twice for every commit on a PR. One for (push) and one for (pull request). We actually often get into a situation where the push test is done, but we're still waiting on the pull request CI test.

Is it possible to de-duplicate this? Perhaps only having tests on commit? (Do we lose anything by doing that?)

@niccoloraspa
Copy link
Member

As you said we run the test workflow on any push to any branch and any pull_request event:

# Event that triggers the workflow
on:
  pull_request:           # any pull_request event:
  push:                   # any push to any branch 
    branches:
      - '**'	

Possible solutions to avoid duplicated runs are:

  1. Don't run the workflow on pull_request event:
on:
  push:
    branches:
      - '**'	

This is super simple to do but doing so we lose the codecov report comment on PRs as in #1098 (comment).
I think that the report would still will be accessible inspecting the workflow run.

  1. A more complicated solution to avoid running both on push and on pull_request would be to add a check before running the job using https://github.com/fkirc/skip-duplicate-actions.
    It would complicate a little bit the workflow and might need some tweaking to find the right configuration but it's doable. More info: https://github.com/fkirc/skip-duplicate-actions#example-1-skip-entire-jobs

If we don't care much about the codecov report on the comment I would go with 1 which is super simple to do. Otherwise I'll start to play around with https://github.com/fkirc/skip-duplicate-actions.

What do you think?

@ValarDragon
Copy link
Member Author

I think 2 would be nice. I don't really use codecov that often, but it seems like a good thing to do / incorporate more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants