All checks were successful
Check / check (push) Successful in 4s
## Changes - Add `docker` target (`docker build .`) - Add `hooks` target (installs pre-commit hook running `make check`) - Add 30-second timeout to `test` target (`-timeout 30s`) - Update `.PHONY` to include new targets - Update README to document all Makefile targets (`fmt-check`, `docker`, `hooks`) - Run `make fmt` to fix JS formatting via prettier `docker build .` passes ✅ closes #136, closes #137 <!-- session: agent:sdlc-manager:subagent:44375174-444b-43bf-a341-2def7ebb9fdf --> Co-authored-by: clawbot <clawbot@noreply.git.eeqj.de> Co-authored-by: Jeffrey Paul <sneak@noreply.example.org> Reviewed-on: #159 Co-authored-by: clawbot <clawbot@noreply.example.org> Co-committed-by: clawbot <clawbot@noreply.example.org>
44 lines
1.0 KiB
Makefile
44 lines
1.0 KiB
Makefile
.PHONY: all build lint fmt fmt-check test check clean docker hooks
|
|
|
|
BINARY := upaasd
|
|
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
|
BUILDARCH := $(shell go env GOARCH)
|
|
LDFLAGS := -X main.Version=$(VERSION) -X main.Buildarch=$(BUILDARCH)
|
|
|
|
all: check build
|
|
|
|
build:
|
|
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/upaasd
|
|
|
|
lint:
|
|
golangci-lint run --config .golangci.yml ./...
|
|
|
|
fmt:
|
|
gofmt -s -w .
|
|
goimports -w .
|
|
npx prettier --write --tab-width 4 static/js/*.js
|
|
|
|
fmt-check:
|
|
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1)
|
|
|
|
test:
|
|
go test -v -race -cover -timeout 30s ./...
|
|
|
|
# Check runs all validation without making changes
|
|
# Used by CI and Docker build - fails if anything is wrong
|
|
check: fmt-check lint test
|
|
@echo "==> All checks passed!"
|
|
|
|
docker:
|
|
docker build .
|
|
|
|
hooks:
|
|
@echo "Installing pre-commit hook..."
|
|
@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."
|
|
|
|
clean:
|
|
rm -rf bin/
|