Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (58 loc) · 1.8 KB
/
Copy pathMakefile
File metadata and controls
76 lines (58 loc) · 1.8 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
# NeoCoin Makefile
# Reproducible build system
.PHONY: build build-reproducible test lint fmt vuln docker-build docker-build-reproducible docker-up docker-down clean install-deps smoke testnet mainnet
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILD_TIME := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
GOFLAGS := -trimpath -mod=readonly
# Default build (cmd/node)
build:
go build ${GOFLAGS} -o neocoin ./cmd/node
# Reproducible build (deterministic)
build-reproducible:
GOWORK=off go build -ldflags="-s -w \
-X main.version=${VERSION} \
-X main.buildTime=${BUILD_TIME}" \
-mod=vendor -o neocoin ./cmd/node
# Build with debug info
build-debug:
go build -o neocoin ./cmd/node
# Run tests
test:
go test -v -race -coverprofile=coverage.out ./...
# Run linter
lint:
golangci-lint run ./...
# Format code
fmt:
go fmt ./...
# Vulnerability scan
vuln:
go sec ./...
# Docker build (production)
docker-build:
docker build -t neocoin/blockchain:${VERSION} -t neocoin/blockchain:latest -f docker/Dockerfile .
# Docker build (reproducible)
docker-build-reproducible:
docker build --build-arg VERSION=${VERSION} --build-arg BUILD_TIME=${BUILD_TIME} \
-t neocoin/blockchain:${VERSION} -t neocoin/blockchain:latest -f docker/Dockerfile.reproducible .
# Docker compose up
docker-up:
docker compose -f docker/docker-compose.yml up -d
# Docker compose down
docker-down:
docker compose -f docker/docker-compose.yml down
# Clean build artifacts
clean:
rm -f neocoin coverage.out
# Install dependencies
install-deps:
go mod download
# Run smoke tests
smoke:
docker compose -f docker-compose.smoke.yml up --build --abort-on-container-exit
# Run testnet
testnet:
docker compose -f docker-compose.testnet.yml up -d
# Run mainnet
mainnet:
docker compose -f docker-compose.mainnet.yml up -d