bring repo into compliance with repo policies #14

Merged
sneak merged 15 commits from chore/repo-compliance into main 2026-02-25 14:52:56 +01:00
Showing only changes of commit a1c0ae0a44 - Show all commits

View File

@@ -3,8 +3,16 @@
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev") VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -X main.Version=$(VERSION) LDFLAGS := -X main.Version=$(VERSION)
# nix-shell wrapper for targets that need CGO dependencies (libvips, pkg-config) # Use nix-shell to provide CGO dependencies unless they are already available
NIX_SHELL := nix-shell -p pkg-config vips libheif golangci-lint git --run # (e.g. inside a Docker build or an existing nix-shell).
HAS_PKGCONFIG := $(shell command -v pkg-config 2>/dev/null)
ifdef HAS_PKGCONFIG
NIX_RUN_PREFIX =
NIX_RUN_SUFFIX =
else
NIX_RUN_PREFIX = nix-shell -p pkg-config vips libheif golangci-lint git --run '
NIX_RUN_SUFFIX = '
endif
# Default target: run all checks # Default target: run all checks
check: fmt-check lint test check: fmt-check lint test
@@ -22,17 +30,17 @@ fmt:
# Run linter # Run linter
lint: lint:
@echo "Running linter..." @echo "Running linter..."
$(NIX_SHELL) "golangci-lint run" $(NIX_RUN_PREFIX)golangci-lint run$(NIX_RUN_SUFFIX)
# Run tests (30-second timeout) # Run tests (30-second timeout)
test: test:
@echo "Running tests..." @echo "Running tests..."
$(NIX_SHELL) "CGO_ENABLED=1 go test -timeout 30s -v ./..." $(NIX_RUN_PREFIX)CGO_ENABLED=1 go test -timeout 30s -v ./...$(NIX_RUN_SUFFIX)
# Build the binary # Build the binary
build: build:
@echo "Building pixad..." @echo "Building pixad..."
$(NIX_SHELL) "CGO_ENABLED=1 go build -ldflags '$(LDFLAGS)' -o ./bin/pixad ./cmd/pixad" $(NIX_RUN_PREFIX)CGO_ENABLED=1 go build -ldflags "$(LDFLAGS)" -o ./bin/pixad ./cmd/pixad$(NIX_RUN_SUFFIX)
# Clean build artifacts # Clean build artifacts
clean: clean: