-
-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (31 loc) · 1.21 KB
/
Copy pathMakefile
File metadata and controls
41 lines (31 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Get the latest commit branch, hash, and date
TAG=$(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
BRANCH=$(if $(TAG),$(TAG),$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null))
HASH=$(shell git rev-parse --short=7 HEAD 2>/dev/null)
TIMESTAMP=$(shell git log -1 --format=%ct HEAD 2>/dev/null | xargs -I{} date -u -r {} +%Y%m%dT%H%M%S)
GIT_REV=$(shell printf "%s-%s-%s" "$(BRANCH)" "$(HASH)" "$(TIMESTAMP)")
REV=$(if $(filter --,$(GIT_REV)),latest,$(GIT_REV))
all: test build
build:
go build -ldflags "-X main.revision=$(REV) -s -w" -o .bin/revdiff.$(BRANCH) ./app
cp .bin/revdiff.$(BRANCH) .bin/revdiff
test:
go clean -testcache
go test -race -coverprofile=coverage.out ./...
grep -v "_mock.go" coverage.out | grep -v mocks > coverage_no_mocks.out
go tool cover -func=coverage_no_mocks.out
rm coverage.out coverage_no_mocks.out
lint:
golangci-lint run
fmt:
~/.claude/format.sh
race:
go test -race -timeout=100s ./...
version:
@echo "branch: $(BRANCH), hash: $(HASH), timestamp: $(TIMESTAMP)"
@echo "revision: $(REV)"
site:
@echo "site assets are in site/ directory"
validate-themes:
go test -run TestGalleryThemes_validate ./app/theme/
.PHONY: build test lint fmt race version site validate-themes