forked from Cogwheel-Validator/spectra-gnoland-indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (64 loc) · 2.69 KB
/
Copy pathMakefile
File metadata and controls
84 lines (64 loc) · 2.69 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
.PHONY: build
install
clean
build-experimental
install-experimental
build-api
integration-test
test
vulnerability-scan
snyk
semgrep
code-quality
########################################################
# Build and install the indexer
########################################################
# Get git information
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
GIT_TAG := $(shell git describe --tags --exact-match 2>/dev/null || echo "")
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
VERSION := $(if $(GIT_TAG),$(GIT_TAG),$(GIT_BRANCH)-$(GIT_COMMIT))
build:
mkdir -p build
go build -ldflags="-X github.com/Cogwheel-Validator/spectra-gnoland-indexer/indexer/cmd.Commit=$(GIT_COMMIT) -X github.com/Cogwheel-Validator/spectra-gnoland-indexer/indexer/cmd.Version=$(VERSION)" -o build/indexer indexer/indexer.go
install:
go install -ldflags="-X github.com/Cogwheel-Validator/spectra-gnoland-indexer/indexer/cmd.Commit=$(GIT_COMMIT) -X github.com/Cogwheel-Validator/spectra-gnoland-indexer/indexer/cmd.Version=$(VERSION)" indexer/indexer.go
build-api:
mkdir -p build
go build -ldflags="-X main.Commit=$(GIT_COMMIT) -X main.Version=$(VERSION)" -o build/api api/main.go
clean:
rm -rf build
# experimental build with greentea garbage collection
# use at your own risk
build-experimental:
GOEXPERIMENT=greenteagc go build -ldflags="-X github.com/Cogwheel-Validator/spectra-gnoland-indexer/indexer/cmd.Commit=$(GIT_COMMIT) -X github.com/Cogwheel-Validator/spectra-gnoland-indexer/indexer/cmd.Version=$(VERSION)" -o build/indexer-tea indexer/indexer.go
########################################################
# Test the indexer
########################################################
test:
go test -v ./...
integration-test:
cd integration && go test -v -tags=integration -timeout=20m ./...
########################################################
# Vulnerability scanning
########################################################
vulnerability-scan:
govulncheck ./...
snyk:
snyk test
semgrep:
semgrep ci
########################################################
# Code quality
########################################################
code-quality:
golangci-lint run
########################################################
# Train the zstd dictionary
########################################################
.PHONY: train-zstd
train-zstd:
@echo "Training the zstd dictionary"
@read -p "Enter the amount of events to collect (default: 10000): " amount; \
amount=$${amount:-10000}; \
go run compression/cmd/main.go --config training-config.yml --amount $$amount --chain-name gnoland --dict-path ./pkgs/dict_loader/events.zstd.bin