-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (70 loc) · 2.56 KB
/
Makefile
File metadata and controls
86 lines (70 loc) · 2.56 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
.PHONY: build test acceptance-test acceptance-test-with-token acceptance-test-fast acceptance-test-fast-with-token clean install lint fmt vet
# Get version from git tags, or use "dev" if not on a tag
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
# Build the binary
build:
go build -ldflags "-X main.version=$(VERSION)" -o tile-diff ./cmd/tile-diff
# Run unit tests
test:
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./pkg/...
# Run tests with coverage report
test-coverage: test
go tool cover -html=coverage.txt -o coverage.html
# Run Ginkgo acceptance tests (requires PIVNET_TOKEN env var)
acceptance-test: build
@if [ -z "$$PIVNET_TOKEN" ]; then \
echo "Error: PIVNET_TOKEN environment variable is required"; \
echo "Export it or use 'make acceptance-test-with-token'"; \
exit 1; \
fi
TILE_DIFF_BIN="$(PWD)/tile-diff" ginkgo -v ./test
# Run Ginkgo acceptance tests with PIVNET_TOKEN from command line
# Usage: make acceptance-test-with-token PIVNET_TOKEN=your-token-here
acceptance-test-with-token: build
@if [ -z "$(PIVNET_TOKEN)" ]; then \
echo "Error: PIVNET_TOKEN is required"; \
echo "Usage: make acceptance-test-with-token PIVNET_TOKEN=your-token-here"; \
exit 1; \
fi
TILE_DIFF_BIN="$(PWD)/tile-diff" PIVNET_TOKEN=$(PIVNET_TOKEN) ginkgo -v ./test
# Run fast acceptance tests only (skip slow download tests)
# Usage: make acceptance-test-fast PIVNET_TOKEN=your-token-here
acceptance-test-fast: build
@if [ -z "$$PIVNET_TOKEN" ]; then \
echo "Error: PIVNET_TOKEN environment variable is required"; \
echo "Export it or use 'make acceptance-test-fast-with-token'"; \
exit 1; \
fi
TILE_DIFF_BIN="$(PWD)/tile-diff" ginkgo -v --label-filter='!slow' ./test
# Run fast acceptance tests with PIVNET_TOKEN from command line
# Usage: make acceptance-test-fast-with-token PIVNET_TOKEN=your-token-here
acceptance-test-fast-with-token: build
@if [ -z "$(PIVNET_TOKEN)" ]; then \
echo "Error: PIVNET_TOKEN is required"; \
echo "Usage: make acceptance-test-fast-with-token PIVNET_TOKEN=your-token-here"; \
exit 1; \
fi
TILE_DIFF_BIN="$(PWD)/tile-diff" PIVNET_TOKEN=$(PIVNET_TOKEN) ginkgo -v --label-filter='!slow' ./test
# Run all tests (unit + acceptance)
test-all: test acceptance-test
# Clean build artifacts
clean:
rm -f tile-diff coverage.txt coverage.html
# Install the binary
install:
go install ./cmd/tile-diff
# Run linters
lint:
golangci-lint run
# Format code
fmt:
go fmt ./...
# Run go vet
vet:
go vet ./...
# Run all checks
check: fmt vet test
# Download dependencies
deps:
go mod download
go mod tidy