Skip to content

Commit

Permalink
feat: add Makefile for easier linting and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
MSevey committed Apr 23, 2024
1 parent 6939a09 commit b08db32
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
57 changes: 57 additions & 0 deletions Makefile
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

0 comments on commit b08db32

Please sign in to comment.