Add test coverage to the makefile
This commit is contained in:
		
							
								
								
									
										7
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								Makefile
									
									
									
									
									
								
							| @@ -10,6 +10,7 @@ COMMIT_DATETIME := $(shell git log -1 --format=%cd --date=iso8601) | ||||
| LDFLAGS := -X git.omicron.one/omicron/linkshare/internal/version.Version=$(VERSION) \ | ||||
|            -X git.omicron.one/omicron/linkshare/internal/version.GitCommit=$(COMMIT) \ | ||||
|            -X "git.omicron.one/omicron/linkshare/internal/version.CommitDateTime=$(COMMIT_DATETIME)" | ||||
| OPEN = xdg-open | ||||
|  | ||||
|  | ||||
| all: build | ||||
| @@ -25,7 +26,10 @@ $(BINARIES): %: $(BINARY_DIR) | ||||
| 	go build -ldflags '$(LDFLAGS)' -o $(BINARY_DIR)/$@ ./cmd/$@/ | ||||
|  | ||||
| test: | ||||
| 	go test ./... | ||||
| 	mkdir -p reports/coverage/ | ||||
| 	go test ./... -coverprofile=reports/coverage/coverage.out | ||||
| 	go tool cover -html=reports/coverage/coverage.out -o reports/coverage/coverage.html && $(OPEN) reports/coverage/coverage.html | ||||
|  | ||||
|  | ||||
| validate: | ||||
| 	@test -z "$(shell gofumpt -l .)" && echo "No files need formatting" || (echo "Incorrect formatting in:"; gofumpt  -l .; exit 1) | ||||
| @@ -33,6 +37,7 @@ validate: | ||||
|  | ||||
| clean: | ||||
| 	rm -rf $(BINARY_DIR) | ||||
| 	rm -rf reports | ||||
| 	go clean | ||||
|  | ||||
| run: $(LINKSERV) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user