Skip to content

Commit

Permalink
chore: update docs and makefile (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramizpolic authored Nov 9, 2023
1 parent ddd2cc1 commit 08661e7
Show file tree
Hide file tree
Showing 4 changed files with 356 additions and 365 deletions.
59 changes: 42 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,72 @@

export PATH := $(abspath bin/):${PATH}

# Dependency versions
GOLANGCI_VERSION = 1.53.3
LICENSEI_VERSION = 0.8.0
##@ General

# Targets commented with ## will be visible in "make help" info.
# Comments marked with ##@ will be used as categories for a group of targets.

.PHONY: help
default: help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ Build

.PHONY: build
build: ## Build binary
@mkdir -p build
go build -race -o build/

##@ Checks

.PHONY: check
check: lint test ## Run lint checks and tests

.PHONY: test
test: ## Run tests
go test -race -v ./...

.PHONY: lint
lint: lint-go lint-yaml #lint-docker
lint: ## Run linters

.PHONY: lint-go
lint-go:
golangci-lint run $(if ${CI},--out-format github-actions,)

#.PHONY: lint-docker
#lint-docker:
# hadolint Dockerfile
$(GOLANGCI_LINT_BIN) run $(if ${CI},--out-format github-actions,)

.PHONY: lint-yaml
lint-yaml:
yamllint $(if ${CI},-f github,) --no-warnings .

.PHONY: license-check
license-check: ## Run license check
$(LICENSEI_BIN) check
$(LICENSEI_BIN) header

.PHONY: fmt
fmt: ## Format code
golangci-lint run --fix
$(GOLANGCI_LINT_BIN) run --fix

.PHONY: test
test: ## Run tests
go test -race -v ./...

.PHONY: license-check
license-check: ## Run license check
licensei check
licensei header
##@ Dependencies

deps: bin/golangci-lint bin/licensei
deps: ## Install dependencies

# Dependency versions
GOLANGCI_VERSION = 1.53.3
LICENSEI_VERSION = 0.8.0

# Dependency binaries
GOLANGCI_LINT_BIN := golangci-lint
LICENSEI_BIN := licensei

# If we have "bin" dir, use those binaries instead
ifneq ($(wildcard ./bin/.),)
GOLANGCI_LINT_BIN := bin/$(GOLANGCI_LINT_BIN)
LICENSEI_BIN := bin/$(LICENSEI_BIN)
endif

bin/golangci-lint:
@mkdir -p bin
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- v${GOLANGCI_VERSION}
Expand Down
Loading

0 comments on commit 08661e7

Please sign in to comment.