Skip to content

Commit

Permalink
add makefile targets to install and verify using codespell 2.2.5
Browse files Browse the repository at this point in the history
- adds target to install codespell v2.2.5 at hack/tools/bin/codespell
- adds a target to verify codebase with installed codespell bin
- remove codespell github action
  • Loading branch information
nawazkh committed Jul 7, 2023
1 parent 0888c64 commit f8fb641
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/codespell.yml

This file was deleted.

20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ KIND_VER := v0.19.0
KIND_BIN := kind
KIND := $(TOOLS_BIN_DIR)/$(KIND_BIN)-$(KIND_VER)

CODESPELL_VER := 2.2.5
CODESPELL_BIN := codespell
CODESPELL_DIST_DIR := codespell_dist
CODESPELL := $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/$(CODESPELL_BIN)

SETUP_ENVTEST_VER := v0.0.0-20211110210527-619e6b92dab9
SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
Expand Down Expand Up @@ -234,7 +239,7 @@ format-tiltfile: ## Format the Tiltfile.
./hack/verify-starlark.sh fix

.PHONY: verify
verify: verify-boilerplate verify-modules verify-gen verify-shellcheck verify-conversions verify-tiltfile ## Run "verify-boilerplate", "verify-modules", "verify-gen", "verify-shellcheck", "verify-conversions", "verify-tiltfile" rules.
verify: verify-boilerplate verify-modules verify-gen verify-shellcheck verify-conversions verify-tiltfile verify-codespell ## Run "verify-boilerplate", "verify-modules", "verify-gen", "verify-shellcheck", "verify-conversions", "verify-tiltfile" "verify-codespell" rules.

.PHONY: verify-boilerplate
verify-boilerplate: ## Verify boilerplate header.
Expand Down Expand Up @@ -264,6 +269,10 @@ verify-conversions: $(CONVERSION_VERIFIER) ## Verifies expected API conversion
verify-tiltfile: ## Verify Tiltfile format.
./hack/verify-starlark.sh

.PHONY: verify-codespell
verify-codespell: codespell ## Verify codespell.
@$(CODESPELL) $(ROOT_DIR) --ignore-words=$(ROOT_DIR)/.codespellignore --skip="*.git,*_artifacts,*.sum,$(ROOT_DIR)/hack/tools/bin/codespell_dist"

## --------------------------------------
## Development
## --------------------------------------
Expand Down Expand Up @@ -762,6 +771,7 @@ helm: $(HELM) ## Build a local copy of helm.
yq: $(YQ) ## Build a local copy of yq.
kind: $(KIND) ## Build a local copy of kind.
setup-envtest: $(SETUP_ENVTEST) ## Build a local copy of setup-envtest.
codespell : $(CODESPELL) ## Build a local copy of codespell.

$(CONVERSION_VERIFIER): go.mod
cd $(TOOLS_DIR); go build -tags=tools -o $@ sigs.k8s.io/cluster-api/hack/tools/conversion-verifier
Expand Down Expand Up @@ -841,3 +851,11 @@ $(SETUP_ENVTEST_BIN): $(SETUP_ENVTEST) ## Build a local copy of setup-envtest.

$(SETUP_ENVTEST): # Build setup-envtest from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(SETUP_ENVTEST_PKG) $(SETUP_ENVTEST_BIN) $(SETUP_ENVTEST_VER)

$(CODESPELL): ## Build codespell from tools folder.
@which $(CODESPELL) >/dev/null || ( \
mkdir -p $(TOOLS_BIN_DIR); \
pip install --target=$(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR) $(CODESPELL_BIN)==$(CODESPELL_VER); \
mv $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/bin/$(CODESPELL_BIN) $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR); \
rm -r $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/bin; \
)
7 changes: 5 additions & 2 deletions docs/book/src/developers/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@
- [install instructions](https://kubectl.docs.kubernetes.io/installation/kustomize/) on Windows + WSL2.
- [install instructions][kustomizelinux] on Linux.
6. Install Python 3.x or 2.7.x, if neither is already installed.
7. Install make.
7. Install pip
- [pip installation instruction](https://pip.pypa.io/en/stable/installation/#installation)
8. Install make.
- `brew install make` on MacOS.
- `sudo apt install make` on Windows + WSL2.
- `sudo apt install make` on Linux.
8. Install [timeout][timeout]
9. Install [timeout][timeout]
- `brew install coreutils` on macOS.

When developing on Windows, it is suggested to set up the project on Windows + WSL2 and the file should be checked out on as wsl file system for better results.
Expand Down Expand Up @@ -459,6 +461,7 @@ If you're interested in submitting PRs to the project, please be sure to run som
```bash
make lint # Runs a suite of quick scripts to check code structure
make lint-fix # Runs a suite of quick scripts to fix lint errors
make verify # Runs a suite of verifying binaries
make test # Runs tests on the Go code
```

Expand Down

0 comments on commit f8fb641

Please sign in to comment.