-
Notifications
You must be signed in to change notification settings - Fork 124
/
Makefile
39 lines (38 loc) · 1.41 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
# Go parameters
GOCMD=GO111MODULE=on CGO_ENABLED=0 go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
BINARY_NAME=pluto
COMMIT := $(shell git rev-parse HEAD)
VERSION := "local-dev"
all: lint test
build:
$(GOBUILD) -o $(BINARY_NAME) -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -s -w" -v ./cmd/pluto/main.go
lint:
golangci-lint run
reportcard:
goreportcard-cli -t 100 -v
test:
$(GOCMD) test -v --bench --benchmem -coverprofile coverage.txt -covermode=atomic ./...
$(GOCMD) vet ./... 2> govet-report.out
$(GOCMD) tool cover -html=coverage.txt -o cover-report.html
printf "\nCoverage report available at cover-report.html\n\n"
tidy:
$(GOCMD) mod tidy
clean:
$(GOCLEAN)
$(GOCMD) fmt ./...
rm -f $(BINARY_NAME)
# Cross compilation
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME) -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -s -w" -v ./cmd/pluto/main.go
build-windows:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME) -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -s -w" -v ./cmd/pluto/main.go
build-docker: build-linux
docker build --build-arg version=$(VERSION) --build-arg commit=$(COMMIT) -t us-docker.pkg.dev/fairwinds-ops/oss/pluto/$(BINARY_NAME):dev .
orb-validate:
circleci orb pack orb/ > orb.yml
circleci orb validate orb.yml
circleci-validate:
circleci config validate --org-slug github/FairwindsOps