-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (47 loc) · 1.28 KB
/
Makefile
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
# Makefile for building the Allora Producer project
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOGENERATE=$(GOCMD) generate
# Main package path
MAIN_PACKAGE=./cmd/producer
PWD=$(shell pwd)
# Binary name
BINARY_NAME=bin/allora-producer
# Build the project
build:
$(GOBUILD) -o $(BINARY_NAME) -v $(MAIN_PACKAGE)
# Clean build files
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
# Run tests
test:
$(GOTEST) -v ./...
# Get dependencies
deps:
$(GOGET) -v -t -d ./...
generate:
$(GOGENERATE) ./...
# Build and run
run: build
./$(BINARY_NAME)
lint:
@echo "--> Running linter"
docker run -t --rm -v $(PWD):/app -v ~/.cache/golangci-lint/v1.61.0:/root/.cache -w /app golangci/golangci-lint:v1.61.0 golangci-lint run -v
# golangci-lint must be installed locally. It's the fastest way to run the linter.
lint-local:
@echo "--> Running linter"
golangci-lint run --timeout=10m
cover:
mkdir -p coverage
rm -rf coverage/*
$(GOTEST) -coverprofile=./coverage/coverage.out.tmp ./...
grep -v mock ./coverage/coverage.out.tmp | grep -v allora-chain > ./coverage/coverage.out
$(GOCMD) tool cover -html=./coverage/coverage.out -o ./coverage/coverage.html
$(GOCMD) tool cover -func=./coverage/coverage.out
# Default target
.DEFAULT_GOAL := build