Skip to content

Commit

Permalink
feat(ci): fail if there are changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
antosdaniel committed Nov 4, 2023
1 parent 0ebce44 commit 442608f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check generated files

on: [push]

jobs:
gen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Install tools
run: make install

- name: Generate code
run: |
# We need to start database and run migrations
docker compose up db -d
docker compose run migrate
# Regenerate code
make generate
# Cleanup
docker compose down
- name: Fail if there are changed files
run: |
CHANGED_FILES=$(git diff --name-only)
if [ -n "${CHANGED_FILES}" ]; then
echo "Your generated files are off. Don't forget to run 'make generate'. Files with changes:"
echo "${CHANGED_FILES}"
exit 1
fi
1 change: 1 addition & 0 deletions internal/grpc/payrollService.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
)

//go:generate mockgen -source payrollService.go -destination mocks/mocks.go -package mocks

//go:generate gowrap gen -g -p ../../gen/grpc/payroll/payrollv1/payrollv1connect -i PayrollServiceHandler -t ./../../templates/log -o payrollServiceWithLogs.go

type payrollServiceServer struct {
Expand Down

0 comments on commit 442608f

Please sign in to comment.