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

Add github action that ensures all commits in a PR build successfully #640

Open
achilleas-k opened this issue Apr 26, 2024 · 0 comments
Open

Comments

@achilleas-k
Copy link
Member

achilleas-k commented Apr 26, 2024

Sometimes weird commits make it into PRs that do something strange (and invalid, codewise) but then revert it in a later commit. I've done this accidentally a few times when rebasing or cleaning up the git history to prep a PR after some experimentation.

We should have a github action that makes sure all commits in a PR at least compile. They don't need to pass all tests or even strictly pass linting, but the following should at least run without error:

 git rebase $(git merge-base origin/main HEAD) --exec 'go build ./...'

I was always a bit skeptical about requiring something like this because I'd rather prioritise readability. Sometimes it can be a little difficult to make clean, isolated commits when also trying to keep this requirement. For example, sometimes it looks cleaner to modify a function that requires modifying the function's signature in one commit and then have one or more commits after that go through every other subpackage that calls it and update the function calls to match. However, I'm coming around to thinking this isn't that problematic in the end and it works out fine, and is just as readable, if the signature changes in a single commit along with all the function calls, while the implementation that required it happens after.

A description for this requirement should be added to the contributor guide as well.

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

No branches or pull requests

1 participant