- Pin golangci-lint to v1.64.8 by sha256 digest - Pin golang to 1.22.12 by sha256 digest - Lint stage runs make fmt-check + make lint - Test stage runs make test with dependency on lint stage - Remove redundant final stage (library has no binary) - Add fmt-check, check, hooks targets to Makefile - Add .gitea/workflows/check.yml for CI closes #9
29 lines
526 B
Makefile
29 lines
526 B
Makefile
.PHONY: test fmt fmt-check lint check docker hooks
|
|
|
|
default: check
|
|
|
|
test:
|
|
@go test -v ./...
|
|
|
|
fmt:
|
|
goimports -l -w .
|
|
golangci-lint run --fix
|
|
|
|
fmt-check:
|
|
@test -z "$$(gofmt -l .)" || { echo "gofmt would reformat:"; gofmt -l .; exit 1; }
|
|
|
|
lint:
|
|
golangci-lint run
|
|
|
|
check: fmt-check lint test
|
|
|
|
docker:
|
|
docker build --progress plain .
|
|
|
|
hooks:
|
|
@echo "Installing git hooks..."
|
|
@mkdir -p .git/hooks
|
|
@printf '#!/bin/sh\nmake check\n' > .git/hooks/pre-commit
|
|
@chmod +x .git/hooks/pre-commit
|
|
@echo "Pre-commit hook installed."
|