diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-04-09 21:57:05 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-04-09 21:57:05 +0200 |
| commit | 2b1a816d85bbb6ab38e975cd6aa6b8894aad0017 (patch) | |
| tree | 18725f3cb9164e3285a530a1db8b406df20c1f39 /Makefile | |
| parent | 3dc101181ac04791b423441424dd4937f31d46fa (diff) | |
| download | go-oblast-2b1a816d85bbb6ab38e975cd6aa6b8894aad0017.tar.gz | |
project scaffold
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c042ca6 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: 2026 Stefan Majewsky <majewsky@gmx.net> +# SPDX-License-Identifier: Apache-2.0 + +default: help + +check: static-check build/cover.html + +static-check: FORCE + @printf "\e[1;36m>> golangci-lint\e[0m\n" + @golangci-lint config verify + @golangci-lint run + @printf "\e[1;36m>> reuse lint\e[0m\n" + @if ! reuse lint -q; then reuse lint; fi + +GO_COVERPKGS := $(shell go list ./... | tr '\n' , | sed 's/,$$//') +GO_TESTPKGS := $(shell go list -f '{{if or .TestGoFiles .XTestGoFiles}}{{.ImportPath}}{{end}}' ./...) + +build/cover.out: FORCE + @printf "\e[1;36m>> go test\e[0m\n" + go test -shuffle=on -coverprofile=build/cover.out -covermode=count -coverpkg=$(GO_COVERPKGS) $(GO_TESTPKGS) +build/cover.html: build/cover.out + @printf "\e[1;36m>> go tool cover\e[0m\n" + go tool cover -html $< -o $@ + +help: FORCE + @printf "\n" + @printf "\e[1mUsage:\e[0m\n" + @printf " make \e[36m<target>\e[0m\n" + @printf "\n" + @printf "\e[1mTest\e[0m\n" + @printf " \e[36mcheck\e[0m Run all tests and checks.\n" + @printf " \e[36mstatic-check\e[0m Run static code checks.\n" + @printf " \e[36mbuild/cover.out\e[0m Run tests and generate coverage report.\n" + @printf " \e[36mbuild/cover.html\e[0m Generate an HTML file with source code annotations from the coverage report.\n" + @printf "\n" + +.PHONY: FORCE |
