feat: bring repo up to REPO_POLICIES standards
All checks were successful
check / check (push) Successful in 2m19s
All checks were successful
check / check (push) Successful in 2m19s
- Create cmd/webhooker/main.go with fx dependency injection wiring - Add REPO_POLICIES.md, .editorconfig, .dockerignore - Add .gitea/workflows/check.yml for CI (docker build on push) - Rewrite Makefile with all required targets (test, lint, fmt, fmt-check, check, build, hooks, docker, clean, dev, run, deps) - Rewrite Dockerfile with sha256-pinned base images, golangci-lint installed from verified release archive, make check as build step - Fix README.md: add required sections (description, getting started, rationale, design, TODO, license, author) - Integrate TODO.md content into README.md and remove TODO.md - Move config.yaml to configs/config.yaml.example - Fix .gitignore pattern for webhooker binary - Fix static/static.go embed directive (remove empty vendor dir) - Fix database test to use in-memory config (no filesystem dependency) closes #1 closes #2
This commit is contained in:
46
Makefile
46
Makefile
@@ -1,39 +1,43 @@
|
||||
.PHONY: test fmt lint build run clean
|
||||
.PHONY: test lint fmt fmt-check check build run dev deps docker clean hooks
|
||||
|
||||
# Default target
|
||||
test: lint
|
||||
go test -v ./...
|
||||
.DEFAULT_GOAL := check
|
||||
|
||||
fmt:
|
||||
go fmt ./...
|
||||
test:
|
||||
go test -v -race -timeout 30s ./...
|
||||
|
||||
lint:
|
||||
golangci-lint run
|
||||
golangci-lint run --config .golangci.yml ./...
|
||||
|
||||
build: test
|
||||
go build -o bin/webhooker cmd/webhooker/main.go
|
||||
fmt:
|
||||
gofmt -s -w .
|
||||
@command -v goimports >/dev/null 2>&1 && goimports -w . || true
|
||||
|
||||
fmt-check:
|
||||
@test -z "$$(gofmt -s -l .)" || { echo "gofmt needed on:"; gofmt -s -l .; exit 1; }
|
||||
|
||||
check: fmt-check lint test build
|
||||
|
||||
build:
|
||||
go build -o bin/webhooker ./cmd/webhooker
|
||||
|
||||
run: build
|
||||
./bin/webhooker
|
||||
|
||||
clean:
|
||||
rm -rf bin/
|
||||
|
||||
# Development helpers
|
||||
.PHONY: dev deps
|
||||
|
||||
dev:
|
||||
go run cmd/webhooker/main.go
|
||||
go run ./cmd/webhooker
|
||||
|
||||
deps:
|
||||
go mod download
|
||||
go mod tidy
|
||||
|
||||
# Docker targets
|
||||
.PHONY: docker-build docker-run
|
||||
|
||||
docker-build:
|
||||
docker:
|
||||
docker build -t webhooker:latest .
|
||||
|
||||
docker-run: docker-build
|
||||
docker run --rm -p 8080:8080 webhooker:latest
|
||||
clean:
|
||||
rm -rf bin/
|
||||
|
||||
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