58 lines
1.2 KiB
Makefile
58 lines
1.2 KiB
Makefile
ABRA := ./cmd/abra
|
|
COMMIT := $(shell git rev-list -1 HEAD)
|
|
GOPATH := $(shell go env GOPATH)
|
|
LDFLAGS := "-X 'main.Commit=$(COMMIT)'"
|
|
DIST_LDFLAGS := $(LDFLAGS)" -s -w"
|
|
export GOPRIVATE=coopcloud.tech
|
|
|
|
all: format check static build test
|
|
|
|
run:
|
|
@go run -ldflags=$(LDFLAGS) $(ABRA)
|
|
|
|
install:
|
|
@go install -ldflags=$(LDFLAGS) $(ABRA)
|
|
|
|
build-dev:
|
|
@go build -ldflags=$(LDFLAGS) $(ABRA)
|
|
|
|
build:
|
|
@go build -ldflags=$(DIST_LDFLAGS) $(ABRA)
|
|
|
|
clean:
|
|
@rm '$(GOPATH)/bin/abra'
|
|
|
|
format:
|
|
@gofmt -s -w .
|
|
|
|
check:
|
|
@test -z $$(gofmt -l .) || (echo "gofmt: formatting issue - run 'make format' to resolve" && exit 1)
|
|
|
|
static:
|
|
@staticcheck $(ABRA)
|
|
|
|
test:
|
|
@go test ./... -cover -v
|
|
|
|
loc:
|
|
@find . -name "*.go" | xargs wc -l
|
|
|
|
loc-author:
|
|
@git ls-files -z | \
|
|
xargs -0rn 1 -P "$$(nproc)" -I{} sh -c 'git blame -w -M -C -C --line-porcelain -- {} | grep -I --line-buffered "^author "' | \
|
|
sort -f | \
|
|
uniq -ic | \
|
|
sort -n
|
|
|
|
e2e:
|
|
@docker run \
|
|
-v $$(pwd):/src \
|
|
--env-file .e2e.env \
|
|
debian:bullseye-slim \
|
|
sh -c "\
|
|
apt update && apt install -y wget curl git; echo ""; echo ""; \
|
|
git config --global user.email 'e2e@coopcloud.tech'; \
|
|
git config --global user.name 'e2e'; \
|
|
cd /src/tests && bash e2e.sh -- --dev \
|
|
"
|