-
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.
Also advertise the new feature in the README Fixes #6
- Loading branch information
1 parent
8bbb616
commit 0446ddb
Showing
2 changed files
with
61 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,53 @@ | ||
.DEFAULT_GOAL := help | ||
|
||
SHELL := /bin/bash | ||
|
||
GO111MODULE := on | ||
|
||
GOPKG := github.com/veraison/swid | ||
|
||
GOLINT ?= golangci-lint | ||
|
||
ifeq ($(MAKECMDGOALS),lint) | ||
GOLINT_ARGS ?= run --timeout=3m | ||
else | ||
ifeq ($(MAKECMDGOALS),lint-extra) | ||
GOLINT_ARGS ?= run --timeout=3m --issues-exit-code=0 -E dupl -E gocritic -E gosimple -E lll -E prealloc | ||
endif | ||
endif | ||
|
||
.PHONY: lint lint-extra | ||
lint lint-extra: ; $(GOLINT) $(GOLINT_ARGS) | ||
|
||
ifeq ($(MAKECMDGOALS),test) | ||
GOTEST_ARGS ?= -v -race $(GOPKG) | ||
else | ||
ifeq ($(MAKECMDGOALS),test-cover) | ||
GOTEST_ARGS ?= -short -cover $(GOPKG) | ||
endif | ||
endif | ||
|
||
COVER_THRESHOLD := $(shell grep '^name: cover' .github/workflows/ci-go-cover.yml | cut -c13-) | ||
|
||
.PHONY: test test-cover | ||
test test-cover: ; go test $(GOTEST_ARGS) | ||
|
||
presubmit: | ||
@echo | ||
@echo ">>> Check that the reported coverage figures are $(COVER_THRESHOLD)" | ||
@echo | ||
$(MAKE) test-cover | ||
@echo | ||
@echo ">>> Fix any lint error" | ||
@echo | ||
$(MAKE) lint | ||
|
||
.PHONY: help | ||
help: | ||
@echo "Available targets:" | ||
@echo " * test: run unit tests for $(GOPKG)" | ||
@echo " * test-cover: run unit tests and measure coverage for $(GOPKG)" | ||
@echo " * lint: lint sources using default configuration" | ||
@echo " * lint-extra: lint sources using default configuration and some extra checkers" | ||
@echo " * presubmit: check you are ready to push your local branch to remote" | ||
@echo " * help: print this menu" |
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