-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
35 lines (28 loc) · 1.37 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
build:
GOOS=linux GOARCH=amd64 go build -o bin/extensions/lambda-extension-log-shipper -ldflags '-s -w' .
GOOS=linux GOARCH=amd64 go build -o bin/examples/bootstrap -ldflags '-s -w' ./examples/hello-lambda-extension.go
test:
go vet ./...
go test -race -cover -coverprofile cover.out ./...
lint:
@if [ ! -f ./bin/golangci-lint ]; then \
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s "v1.34.1"; \
fi;
@echo "golangci-lint checking..."
@./bin/golangci-lint -v run ./...
mock:
@which mockgen > /dev/null || (echo "No mockgen installed."; exit 1)
@echo "generating mocks..."
@go generate ./...
package: build
cd bin/ && zip -r lambda-extension-log-shipper.zip extensions/
cd bin/examples && zip ../hello-lambda-extension.zip bootstrap
deploy-layer-%: package
aws lambda publish-layer-version --layer-name "lambda-extension-log-shipper" --region $* --zip-file "fileb://bin/lambda-extension-log-shipper.zip"
deploy-examples-%: package
aws lambda update-function-code --function-name hello-lambda-extension --region $* --zip-file "fileb://bin/hello-lambda-extension.zip"
aws lambda list-layer-versions --layer-name lambda-extension-log-shipper --max-items 1 | \
jq -r '.LayerVersions[0].LayerVersionArn' | \
xargs -I{} aws lambda update-function-configuration --function-name hello-lambda-extension --region $* --layers {}
clean:
@rm -rf bin/