-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Makefile for easier linting and formatting
- Loading branch information
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ jobs: | |
with: | ||
go-version: ${{ inputs.go-version }} | ||
- name: Run unit test | ||
run: echo "No Tests" | ||
run: make test | ||
# - name: upload coverage report | ||
# uses: codecov/[email protected] | ||
# with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Define pkgs, run, and cover variables for test so that we can override them in | ||
# the terminal more easily. | ||
pkgs := $(shell go list ./...) | ||
run := . | ||
count := 1 | ||
|
||
## help: Show this help message | ||
help: Makefile | ||
@echo " Choose a command run in "$(PROJECTNAME)":" | ||
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /' | ||
.PHONY: help | ||
|
||
## cover: generate to code coverage report. | ||
# cover: | ||
# @echo "--> Generating Code Coverage" | ||
# @go install github.com/ory/go-acc@latest | ||
# @go-acc -o coverage.txt $(pkgs) | ||
# .PHONY: cover | ||
|
||
## deps: Install dependencies | ||
deps: | ||
@echo "--> Installing dependencies" | ||
@go mod download | ||
@go mod tidy | ||
.PHONY: deps | ||
|
||
## lint: Run linters golangci-lint and markdownlint. | ||
lint: vet | ||
@echo "--> Running golangci-lint" | ||
@golangci-lint run | ||
@echo "--> Running markdownlint" | ||
@markdownlint --config .markdownlint.yaml --ignore './cmd/rollkit/docs/*.md' '**/*.md' | ||
@echo "--> Running yamllint" | ||
@yamllint --no-warnings . -c .yamllint.yml | ||
|
||
.PHONY: lint | ||
|
||
## fmt: Run fixes for linters. | ||
fmt: | ||
@echo "--> Formatting markdownlint" | ||
@markdownlint --config .markdownlint.yaml --ignore './cmd/rollkit/docs/*.md' '**/*.md' -f | ||
@echo "--> Formatting go" | ||
@golangci-lint run --fix | ||
.PHONY: fmt | ||
|
||
## vet: Run go vet | ||
vet: | ||
@echo "--> Running go vet" | ||
@echo $(pkgs) | ||
@go vet $(pkgs) | ||
.PHONY: vet | ||
|
||
## test: Running unit tests | ||
test: vet | ||
@echo "--> No unit tests" | ||
# @go test -v -race -covermode=atomic -coverprofile=coverage.txt $(pkgs) -run $(run) -count=$(count) | ||
.PHONY: test |