aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2025-07-01 11:44:56 +0200
committerStefan Majewsky <majewsky@gmx.net>2025-07-01 11:44:56 +0200
commitcf926f05f994d87e5c9ea4742ef143f10ac927d8 (patch)
tree22bc5f518458db8976bb99d53084cbe878cdd733 /Makefile
parent4bdb5fd20340f5f734f1dea9480a00a2954bfe3a (diff)
downloadgo-gg-cf926f05f994d87e5c9ea4742ef143f10ac927d8.tar.gz
add `make check` target
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4444b40
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,34 @@
+# SPDX-FileCopyrightText: 2025 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
+
+build/cover.out: FORCE
+ @printf "\e[1;36m>> go test\e[0m\n"
+ go test -shuffle=on -coverprofile=build/cover.out -covermode=count ./...
+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