Skip to content

Commit

Permalink
feat: Improvements to Makefile (cosmos#935)
Browse files Browse the repository at this point in the history
Adds option for:
- Cleaning testing cache
- test both race and without race
- lint
Adds `--count=1` flag for tests to avoid cached results
  • Loading branch information
Manav-Aggarwal authored May 15, 2023
1 parent ee81f9c commit ba537ae
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# Built from docs https://yamllint.readthedocs.io/en/stable/configuration.html
extends: default

rules:
# 120 chars should be enough, but don't fail if a line is longer
line-length:
max: 120
level: warning
27 changes: 26 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,32 @@ help: Makefile
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
.PHONY: help

## clean: clean testcache
clean:
@echo "--> Clearing testcache"
@go clean --testcache
.PHONY: clean

## cover: generate to code coverage report.
cover:
@echo "--> Generating Code Coverage"
@go install github.com/ory/go-acc@latest
@go-acc -o coverage.txt `go list ./...`
.PHONY: cover

## lint: Run linters golangci-lint and markdownlint.
lint:
@echo "--> Running golangci-lint"
@golangci-lint run
@echo "--> Running markdownlint"
@markdownlint --config .markdownlint.yaml '**/*.md'
@echo "--> Running hadolint"
@hadolint docker/mockserv.Dockerfile
@echo "--> Running yamllint"
@yamllint --no-warnings . -c .yamllint.yml

.PHONY: lint

## test-unit: Running unit tests
test-unit:
@echo "--> Running unit tests"
Expand All @@ -23,9 +42,15 @@ test-unit:
## test-unit-race: Running unit tests with data race detector
test-unit-race:
@echo "--> Running unit tests with data race detector"
@go test -race `go list ./...`
@go test -race -count=1 `go list ./...`
.PHONY: test-unit-race

### test-all: Run tests with and without data race
test-all:
@$(MAKE) test-unit
@$(MAKE) test-unit-race
.PHONY: test-all

## proto-gen: Generate protobuf files. Requires docker.
proto-gen:
@echo "--> Generating Protobuf files"
Expand Down

0 comments on commit ba537ae

Please sign in to comment.