-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
57 lines (44 loc) · 1.32 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
GO_BUILD_DIR?=build/
GIT_VERSION?=$(shell git rev-parse HEAD)
ldflags := -X 'github.com/livepeer/catalyst-api/config.Version=$(GIT_VERSION)'
.PHONY: all
all: build fmt test lint integration-test tidy
.PHONY: build
build:
go build -ldflags="$(ldflags)" -o "$(GO_BUILD_DIR)catalyst-api" main.go
cp scripts/* "$(GO_BUILD_DIR)"
.PHONY: build-linux
build-linux:
# Useful for cross-compiling from Mac for testing on an environment
env GOOS=linux GOARCH=amd64 go build -ldflags="$(ldflags)" -o "$(GO_BUILD_DIR)catalyst-api-linux" main.go
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: integration-test
integration-test:
go install github.com/cucumber/godog/cmd/[email protected]
cd test && godog run --strict --stop-on-failure 2> ./logs/test.log
.PHONY: lint
lint:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run
.PHONY: run
run:
CATALYST_API_HTTP_ADDR=127.0.0.1:4949 CATALYST_API_HTTP_INTERNAL_ADDR=127.0.0.1:3939 go run main.go
.PHONY: generate
generate:
go install github.com/golang/mock/[email protected]
go generate ./...
.PHONY: test
test: generate
go test -race ./...
.PHONY: test
coverage: generate
go test ./... --covermode=atomic -coverprofile=coverage.out
go tool cover -func=coverage.out
.PHONY: tidy
tidy:
go mod tidy
.PHONY: test-canary
test-canary:
CUCUMBER_ENV=canary $(MAKE) integration-test