Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ jobs:
- name: Go dependencies
run: go mod download

- name: Check codegen is up to date
run: |
go generate ./internal/repository/...
git diff --exit-code -- internal/repository/
git status --porcelain -- internal/repository/ | grep -q . && echo "untracked files in internal/repository/" && exit 1 || true
Comment on lines +29 to +34
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the CI be responsible for this? It doesn't make sense to me to try to generate code in the CI because then why not generate SQLC code too?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted a way to make sure PRs weren't manually editing generated files.

This is more of test than actually generating the result.

Originally i had planned on having sqlc in here too, but it would mean having a fixed version of the sqlc binary used to generate. otherwise you get false positives on the version comment at the top of the gen'd files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I like this, I misunderstood. Well maybe we should bundle everything into a small script? There is nothing stopping us from adding SQLC to be honest. We can just read the files, get the version and check if anything meaningful has changed with the correct binary version. I wonder, could we make this into an action ; )

- name: Install frontend dependencies
run: |
cd frontend
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ sql:

# Go gen
generate:
go run ./gen
go generate ./internal/repository/...
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the ./gen too since it generates the .env.example and documentation reference.

Loading
Loading