All checks were successful
check / check (push) Successful in 1m15s
Restructure Dockerfile to match upaas/dnswatcher pattern: - Separate lint stage using golangci/golangci-lint:v2.1.6 image - Builder stage for tests and compilation (no lint dependency) - Add fmt-check Makefile target - Decouple test from lint in Makefile (lint runs in its own stage) - Run gofmt on all files - docker build verified passing locally
48 lines
985 B
Makefile
48 lines
985 B
Makefile
export CGO_ENABLED=1
|
|
export DOCKER_HOST := ssh://root@ber1app1.local
|
|
|
|
# Version information
|
|
VERSION := 0.1.0
|
|
GIT_COMMIT := $(shell git rev-parse HEAD 2>/dev/null || echo "unknown")
|
|
LDFLAGS := -X 'git.eeqj.de/sneak/secret/internal/cli.Version=$(VERSION)' \
|
|
-X 'git.eeqj.de/sneak/secret/internal/cli.GitCommit=$(GIT_COMMIT)'
|
|
|
|
default: check
|
|
|
|
build: ./secret
|
|
|
|
./secret: ./internal/*/*.go ./pkg/*/*.go ./cmd/*/*.go ./go.*
|
|
go build -v -ldflags "$(LDFLAGS)" -o $@ cmd/secret/main.go
|
|
|
|
vet:
|
|
go vet ./...
|
|
|
|
test: vet
|
|
go test ./... || go test -v ./...
|
|
|
|
fmt:
|
|
go fmt ./...
|
|
|
|
lint:
|
|
golangci-lint run --timeout 5m
|
|
|
|
check: build lint test
|
|
|
|
# Build Docker container
|
|
docker:
|
|
docker build -t sneak/secret .
|
|
|
|
# Run Docker container interactively
|
|
docker-run:
|
|
docker run --rm -it sneak/secret
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
rm -f ./secret
|
|
|
|
install: ./secret
|
|
cp ./secret $(HOME)/bin/secret
|
|
|
|
fmt-check:
|
|
@test -z "$$(gofmt -l .)" || (echo "Files need formatting:" && gofmt -l . && exit 1)
|