-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from mfreeman451/updates/adding_makefile
added makfile
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
GO ?= go | ||
GOBIN ?= $$($(GO) env GOPATH)/bin | ||
GOLANGCI_LINT ?= $(GOBIN)/golangci-lint | ||
GOLANGCI_LINT_VERSION ?= v1.60.3 | ||
|
||
# Code tidy | ||
.PHONY: tidy | ||
tidy: | ||
go mod tidy | ||
go fmt ./... | ||
|
||
.PHONY: get-golangcilint | ||
get-golangcilint: | ||
test -f $(GOLANGCI_LINT) || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$($(GO) env GOPATH)/bin $(GOLANGCI_LINT_VERSION) | ||
|
||
# Runs lint on entire repo | ||
.PHONY: lint | ||
lint: get-golangcilint | ||
$(GOLANGCI_LINT) run ./... | ||
|
||
# Runs tests on entire repo | ||
.PHONY: test | ||
test: | ||
go test -timeout=3s -race -count=10 -failfast -shuffle=on -short ./... -coverprofile=./cover.short.profile -covermode=atomic -coverpkg=./... | ||
go test -timeout=10s -race -count=1 -failfast -shuffle=on ./... -coverprofile=./cover.long.profile -covermode=atomic -coverpkg=./... | ||
|
||
# Runs test coverage check | ||
.PHONY: check-coverage | ||
check-coverage: test | ||
go run ./main.go --config=./.github/.testcoverage.yml | ||
|
||
# View coverage profile | ||
.PHONY: view-coverage | ||
view-coverage: | ||
go test ./... -coverprofile=./cover.all.profile -covermode=atomic -coverpkg=./... | ||
go tool cover -html=cover.all.profile -o=cover.html | ||
xdg-open cover.html |