diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d72352b4..d4e184c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,9 +2,9 @@ We welcome contributions from the community. Please read the following guidelines carefully to maximize the chances of your PR being merged. -## Coding Style +## Development -To ensure your change passes format checks, run `make precommit` and ensure all checks pass. +See `make help`. ## DCO diff --git a/Makefile b/Makefile index 784a3fe7..28f6ef2b 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,23 @@ TAG ?= latest ENABLE_MULTI_PLATFORMS ?= false HELM_CHART_VERSION ?= v0.0.0-latest +# This will print out the help message for contributing to the project. +.PHONY: help +help: + @echo "Usage: make " + @echo "" + @echo "All core targets needed for contributing:" + @echo " precommit Run all necessary steps to prepare for a commit." + @echo " test Run the unit tests for the codebase." + @echo " test-cel Run the integration tests of CEL validation rules in API definitions with envtest." + @echo " This will be needed when changing API definitions." + @echo " test-extproc Run the integration tests for extproc without controller or k8s at all." + @echo " Note that this requires some credentials." + @echo " test-controller Run the integration tests for the controller with envtest." + @echo "" + @echo "For example, 'make precommit test' should be enough for initial iterations, and later 'make test-cel' etc." + @echo "" + # This runs the linter, formatter, and tidy on the codebase. .PHONY: lint lint: golangci-lint @@ -56,20 +73,21 @@ apigen: controller-gen # This runs all necessary steps to prepare for a commit. .PHONY: precommit -precommit: tidy codespell apigen format lint +precommit: tidy codespell apigen format lint editorconfig helm-lint # This runs precommit and checks for any differences in the codebase, failing if there are any. .PHONY: check -check: editorconfig-checker - @$(MAKE) precommit - @$(MAKE) helm-package --version ${HELM_CHART_VERSION} - @echo "running editorconfig-checker" - @$(EDITORCONFIG_CHECKER) +check: precommit @if [ ! -z "`git status -s`" ]; then \ echo "The following differences will fail CI until committed:"; \ git diff --exit-code; \ fi +# This runs the editorconfig-checker on the codebase. +editorconfig: editorconfig-checker + @echo "running editorconfig-checker" + @$(EDITORCONFIG_CHECKER) + # This runs the unit tests for the codebase. .PHONY: test test: