Files
katenary/makefiles/test.mk
Patrice Ferlet 6c2e8fa9b2
All checks were successful
/ build-packages (amd64, darwin) (push) Successful in 1m4s
/ build-packages (amd64, freebsd) (push) Successful in 1m52s
/ build-packages (amd64, linux) (push) Successful in 2m15s
/ build-packages (amd64, windows) (push) Successful in 1m24s
/ build-packages (arm64, freebsd) (push) Successful in 1m48s
/ build-packages (arm64, linux) (push) Successful in 2m13s
Build and push OCI image / build (push) Successful in 1m57s
Go-Tests / tests (push) Successful in 1m31s
Go-Tests / sonar (push) Successful in 42s
chore(typo): remove invisible characters
2025-08-22 14:06:00 +02:00

33 lines
1.1 KiB
Makefile

## TESTS, security analysis, and code quality
# Scan the source code.
# - we don't need detection of text/template as it's not a web application, and
# - we don't need sha1 detection as it is not used for cryptographic purposes.
# Note: metrics are actually not sent to anyone - it's a thing that is removed from the code in the future.
sast:
opengrep \
--config auto \
--exclude-rule go.lang.security.audit.xss.import-text-template.import-text-template \
--exclude-rule go.lang.security.audit.crypto.use_of_weak_crypto.use-of-sha1 \
--metrics=on \
.
test: builder-oci-image
@echo -e "\033[1;33mTesting katenary $(VERSION)...\033[0m"
$(GO_OCI) go test -v -coverprofile=cover.out ./... || exit 1
$(MAKE) cover
cover: builder-oci-image
$(GO_OCI) \
go tool cover -func=cover.out | grep "total:"
$(GO_OCI) \
go tool cover -html=cover.out -o cover.html
show-cover:
@[ -f cover.html ] || (echo "cover.html is not present, run make test before"; exit 1)
if [ "$(BROWSER)" = "xdg-open" ]; then
xdg-open cover.html
else
$(BROWSER) -i --new-window cover.html
fi