All checks were successful
Check / check (push) Successful in 1m4s
## Summary Splits the Dockerfile into separate lint and build stages to provide faster CI feedback on formatting and lint issues. ### Changes **Dockerfile:** - **Lint stage** (`golangci/golangci-lint:v2.10.1`, pinned by sha256): Runs `make fmt-check` and `make lint` using the official golangci-lint image which has the linter pre-installed. No more downloading golangci-lint on every build. - **Build stage** (`golang:1.25-alpine`, pinned by sha256): Runs `make test` and `make build`. Same alpine image as before. - **Runtime stage**: Unchanged. **Makefile:** - Added `fmt-check` target for standalone gofmt checking. - Refactored `check` target to use `fmt-check`, `lint`, `test` as dependencies instead of inline commands. Still works identically for local use. ### Benefits - Lint failures surface immediately without waiting for golangci-lint download - Uses official pre-built golangci-lint image instead of manual binary download - Cleaner separation of concerns between lint and build stages - `make check` still runs everything sequentially for local development closes #151 Co-authored-by: clawbot <clawbot@eeqj.de> Co-authored-by: clawbot <clawbot@noreply.git.eeqj.de> Reviewed-on: #152 Co-authored-by: clawbot <clawbot@noreply.example.org> Co-committed-by: clawbot <clawbot@noreply.example.org>
34 lines
816 B
Makefile
34 lines
816 B
Makefile
.PHONY: all build lint fmt fmt-check test check clean
|
|
|
|
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 ./...
|
|
|
|
# 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!"
|
|
|
|
clean:
|
|
rm -rf bin/
|