diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..444394b --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,49 @@ + + +This PR closes + +### Summary + + + +### Features / Behaviour Changes + + + +### Implementation + + + +### Limitations + + + +### Testing + + + +### Checklist + +Before submitting the PR make sure the following are checked: + +- [ ] This Pull Request is related to one issue. +- [ ] Commit message explains what changed and why +- [ ] Tests are added or updated. +- [ ] Documentation files are updated. +- [ ] I have run pre-commit locally (`pre-commit run --all-files` or hooks on commit) diff --git a/.golangci.yml b/.golangci.yml index 769c6ab..4934928 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,7 @@ version: "2" run: allow-parallel-runners: true + go: "1.25" linters: default: none enable: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6095c27 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,30 @@ +default_stages: [pre-commit] +minimum_pre_commit_version: "2.0.0" +repos: + - repo: local + hooks: + - id: make-generate + name: generate code and manifests + language: system + entry: bash -c "make manifests generate" + types: [go] + pass_filenames: false + + - id: go-mod-tidy + name: run go mod tidy + language: system + entry: go mod tidy + files: ^go\.(mod|sum)$ + pass_filenames: false + + - id: make-lint + name: run golangci-lint + language: system + entry: bash -c "GOTOOLCHAIN=go1.25.3 make lint" + types: [go] + pass_filenames: false + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v0.7.1 + hooks: + - id: check-merge-conflict diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5da8cfa..c955588 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,10 +11,33 @@ Thank you for your interest in contributing to the Valkey Operator! We welcome c - kubectl v1.11.3+ - Access to a Kubernetes cluster (kind, minikube, or cloud provider) +### Development Tools + +This project uses the following tools during development. + +#### golangci-lint + +To install `golangci-lint` locally follow the [official documentation](https://golangci-lint.run/usage/install/#local-installation). + +#### pre-commit + +To install `pre-commit` locally follow the [official documentation](https://pre-commit.com/#install). +`pre-commit` uses the [.pre-commit-config.yaml](.pre-commit-config.yaml) configuration file located in the root of the +project. + +To set up the `git` hook script execute the following command so that the pre-commit steps runs automatically on +each commit. +```bash +pre-commit install +``` + ### Development Setup See the [Developer Guide](./docs/developer-guide.md) for detailed setup instructions. +#### Optional: kubebuilder +[Kubebuilder](https://kubebuilder.io/) is the framework we use for the operator. You will normally not need to use the kubebuilder CLI directly unless you are adding new CRDs or making major changes to the project structure. + Quick start: ```bash