-
Notifications
You must be signed in to change notification settings - Fork 607
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: Catches merge conflicts in go.sum files #6640
Conversation
I didn't quite understand how this is suppose to "notify" us, was your intention to be creating a new PR with the diffs? Or is it suppose to show us the diffs? If so, instead of showing diffs, I feel like we should be directly running go mod tidy within workflow so that we don't have to fix the conflict! |
I am pretty sure that the way this notifies us is by failing |
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 a lot for PR! I have a few concerns:
- tidy step is happening after the build of
osmosisd
finishes. Incorrectly formatted go.sum files can fail the build process on the earlier stage of workflow's execution. Hence, if there are conflicts in go.sum files, this workflow can actually fail prior totidy
step, which won't make it obvious what the problem is. So if we go with this approach, I suggest moving the tidy step before building steps - This approach would only find conflicts in the go.sum file of the root of the repository. I suggest running makefile target recently introduced, namely
tidy-workspace
, in order to rungo mod tidy
in every submodule - Sometimes go mod is not formatted, but it does not mean that a repository is in a bad state. In these cases, it would be inconvenient that build stage in CI fails only because there is slightly not up-to-date go mod in the repository.
To sum up, I still think that if there is a linter that can catch these errors and if so, just enable it. If not, and we are using go mod tidy approach, I do not think it is good to fail CI if it is not a definite go.sum conflict we are facing.
Maybe there are other options to solving this problem that can mitigate it. One approach is to run tidy-workspace
and push changes to a PR's branch every time, say, a PR is opened for review. Even better, if PR got one approval (though, it would in a sense make that approval stale)
Thank you for your concern @pysel! I would move the tidy before build step and use |
Currently I haven't found any |
Now |
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.
hey @anhductn2001! thanks for addressing review. Is it possible not to run tidy step when a PR is merged? It would mean that every PR review essentially reviews a slightly different version of what is going to be committed to main, even though it only tidies the workspace
go-version: ${{env.GO_VERSION}} | ||
- run: | | ||
make tidy-workspace | ||
- uses: EndBug/add-and-commit@v9 |
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.
will this fail the workflow if make tidy-workspace
introduce no changes?
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.
It will not fail @pysel
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.
Can you explain more clearly the meaning of Is it possible not to run tidy step when a PR is merged?
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 workflow runs on push to main (in other words, when a PR is merged). So I am worried that after some PR gets merged, this workflow will commit changes introduced by tidy-workspace
directly to main (if I understand correctly), if any
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.
Ok, I understand. My opinion is:
- Maybe we will never push a commit directly to the main branch, right? So the case of pushing directly to the main can be eliminated.
- In case of merging PR to main, CI will be run in PR first so it will create a commit on the PR branch so I see no problem here.
Yes, I could create a separate workflow for |
This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you! |
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.
ACK, do we have a run of failed CI @anhductn2001 ?
What CI failed? @mattverse |
If you don't want the log to appear every time you run, I can clear it after each run. |
@anhductn2001 Oh I meant do we have a failed run of this CI just to make sure that this CI works as intended! |
This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you! |
Closes: #6538
What is the purpose of the change
Testing and Verifying
Have tested on fork repo here.