[tooling]: Enforce in CI generation of gen.go files #1456
Conversation
ea8c4d6 to
5f02bae
Compare
| - name: Check migrations | ||
| run: ./test/migrations/up_and_down.sh | ||
|
|
||
| generated-files: |
There was a problem hiding this comment.
Sounds like this belongs to repository hygiene. Also put the script in the makefile, and delete the hashfiles?
There was a problem hiding this comment.
I wanted to avoid having it in the Makefile, because it's going to generate the files, and therefor change the state of the repo/files with a check. Is it really ok to do so?
(And locally / in the Makefile, running the check will fix it, so that not really a check ^^')
There was a problem hiding this comment.
Well, if there is a change, we are a in a dirty state and should fail. BTW we could make that explicit by not using hashes but checking if there is any local change (e.g. git diff --exit-code).
So what about doing:
make apis
git diff --exit-code
There was a problem hiding this comment.
And also move it to repo hygiene (i.e. a step in hygiene-tests)
There was a problem hiding this comment.
I did it but
- It will check more than generated files
- It may be influenced by previous steps generating some change for some reasons
so I don't think that the "correctest" approach.
There was a problem hiding this comment.
True that.
But actually as a whole I'd expect the previous steps to not pollute the local repo. Checking that nothing has changed at the end could be a feature IMO :) Should be a bit more explicit though.
What about:
- Out of explicitness, in this step only check for generated files:
git diff --exit-code -- '*.gen.go' - Add a separate step with just
git diff --exit-codethat checks that no other previous step has changed anything previously
There was a problem hiding this comment.
Seems better yes, I changed it slightly:
- Check that generated files didn't change (dues to linting)
- Make apis
- Check that generated files didn't change (if that fail here, it's api)
- Check that files didn't change in another steps
What do you think?
28dda10 to
226ab68
Compare
226ab68 to
1b5a99a
Compare
1b5a99a to
021e63f
Compare
This PR follows #1455
It does enforce that *.gen.go files have been generated and don't change.
Minor side fix on docker run command, that set
-itfor no reason and that make it failing in ci. Changed to--rmbecause locally it's building up useless containers quickly.