forked from kislerdm/aws-lambda-secret-rotation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
29 lines (22 loc) · 1.05 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
.DEFAULT_GOAL := help
help: ## Prints help message.
@ grep -h -E '^[a-zA-Z0-9_-].+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[1m%-30s\033[0m %s\n", $$1, $$2}'
tests: ## Run tests.
@ go mod tidy && \
go test -timeout 3m --tags=unittest -v -coverprofile=.coverage.out . -coverpkg=. && \
go tool cover -func .coverage.out && rm .coverage.out
PLUGIN := neon
test-plugin: ## Run plugin tests.
@ cd plugin/$(PLUGIN) && go mod tidy && \
go test -timeout 3m --tags=unittest -v -coverprofile=.coverage.out . -coverpkg=. && \
go tool cover -func .coverage.out && rm .coverage.out
compile:
@ test -d bin || mkdir -p bin && \
cd plugin/$(PLUGIN) && \
go mod tidy && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ../../bin/$(PLUGIN)/lambda -ldflags="-s -w" ./cmd/lambda/main.go
PREFIX := $(notdir ${PWD})
TAG := ""
build: compile ## Builds the lambda binary and archives it.
@ if [ $(TAG) = "" ]; then echo "specify TAG"; exit 137; fi
@ cd bin/$(PLUGIN) && zip -9 $(PREFIX)_$(PLUGIN)_$(TAG).zip lambda && rm lambda