Skip to content

chore: add pre-check script to validate lint, gen, test, and build#6293

Open
sachin9058 wants to merge 3 commits intomindersec:mainfrom
sachin9058:chore-add-precheck-script
Open

chore: add pre-check script to validate lint, gen, test, and build#6293
sachin9058 wants to merge 3 commits intomindersec:mainfrom
sachin9058:chore-add-precheck-script

Conversation

@sachin9058
Copy link
Copy Markdown
Contributor

Summary

This PR introduces a unified pre-check script to help contributors validate changes locally before pushing.

Currently, contributors need to manually run multiple commands such as go mod tidy, make gen, linting, tests, and build. Missing any of these steps (e.g., forgetting to commit generated files) can lead to avoidable CI failures.

This change adds:

  • A script (scripts/precheck.sh) that runs all required checks
  • A Makefile target (make check) for convenience

This improves contributor experience and reduces CI failures.

No new dependencies are introduced.

Fixes #6292

Testing

The changes were tested locally by running:

make check

This executes:

  • go mod tidy
  • make gen
  • golangci-lint run
  • go test ./...
  • go build ./...

All steps completed successfully with no lint issues, test failures, or build errors.

@sachin9058 sachin9058 requested a review from a team as a code owner April 6, 2026 17:17
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 6, 2026

Coverage Status

Coverage is 58.48%sachin9058:chore-add-precheck-script into mindersec:main. No base build found for mindersec:main.

Comment on lines +7 to +8
echo "Running go mod tidy..."
go mod tidy
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.

Why not roll this into the make gen target?

Comment on lines +16 to +17
echo "Running tests..."
go test ./...
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.

We have a make test target which will run this.

Comment on lines +13 to +14
echo "Running linter..."
golangci-lint run
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.

make lint will run this and buf lint.

Comment on lines +19 to +20
echo "Building project..."
go build ./...
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.

make build will run all the binary builds

Comment on lines +48 to +49
check:
./scripts/precheck.sh
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.

Except for help, we have all the remaining targets in .mk/*.mk. What do you think of moving the check target to develop.mk and having it depend on the gen, lint, test, and build targets?

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

Successfully merging this pull request may close these issues.

Add pre-check script to validate lint, gen, test, and build locally

3 participants