-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
52 lines (38 loc) · 1.34 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
SHELL=/bin/bash
export PATH:=/usr/local/go/bin:~/go/bin/:$(PATH)
GOFMT_FILES?=$$(find . -name '*.go')
WORKDIR =$(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
PROJECT =$(notdir $(WORKDIR))
export VAULT_PLUGIN_DIR =$(WORKDIR)/bin
BINARY_PATH =$(VAULT_PLUGIN_DIR)/$(PROJECT)
module_path := github.com/opentelekomcloud/vault-plugin-secrets-openstack
ldflags := -s -w \
-X $(module_path)/vars.ProjectName=vault-plugin-secrets-openstack \
-X $(module_path)/vars.ProjectDocs=https://$(module_path) \
-X $(module_path)/vars.BuildVersion=$(shell git rev-parse --abbrev-ref HEAD) \
-X $(module_path)/vars.BuildRevision=$(shell git rev-parse --short HEAD) \
-X $(module_path)/vars.BuildDate=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
build:
@mkdir -p $(VAULT_PLUGIN_DIR)
@go build -o $(BINARY_PATH) -ldflags "$(ldflags)"
install:
@go install -trimpath -ldflags "$(ldflags)"
release:
goreleaser release
snapshot:
goreleaser release --snapshot --parallelism 2 --rm-dist
vet:
$(info Running vet...)
@go vet ./...
test: vet
$(info Running unit tests...)
@go test -covermode atomic -coverprofile coverage.out ./openstack/...
cov-report:
go tool cover -html coverage.out -o coverage.html
fmt:
@gofmt -w $(GOFMT_FILES)
lint:
golangci-lint run ./...
functional: build
$(info Running acceptance tests...)
@bash ./scripts/acceptance.sh