fix: split Dockerfile with pinned images and add CI workflow
- 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
This commit is contained in:
17
Makefile
17
Makefile
@@ -1,6 +1,6 @@
|
||||
.PHONY: test
|
||||
.PHONY: test fmt fmt-check lint check docker hooks
|
||||
|
||||
default: test
|
||||
default: check
|
||||
|
||||
test:
|
||||
@go test -v ./...
|
||||
@@ -9,9 +9,20 @@ 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
|
||||
sh -c 'test -z "$$(gofmt -l .)"'
|
||||
|
||||
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."
|
||||
|
||||
Reference in New Issue
Block a user