forked from awslabs/amazon-ecr-credential-helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
83 lines (67 loc) · 2.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
ROOT := $(shell pwd)
VERSION=v0.1.0
all: build
SOURCEDIR=./ecr-login
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
BINARY_NAME=docker-credential-ecr-login
LOCAL_BINARY=bin/local/$(BINARY_NAME)
LINUX_AMD64_BINARY=bin/linux-amd64/$(BINARY_NAME)
DARWIN_AMD64_BINARY=bin/darwin-amd64/$(BINARY_NAME)
WINDOWS_AMD64_BINARY=bin/windows-amd64/$(BINARY_NAME).exe
.PHONY: docker
docker: Dockerfile
docker run --rm \
-e TARGET_GOOS=$(TARGET_GOOS) \
-e TARGET_GOARCH=$(TARGET_GOARCH) \
-v '$(shell pwd)/bin':/go/src/github.com/moonwalker/amazon-ecr-credential-helper/bin \
$(shell docker build -q .)
.PHONY: build
build: $(LOCAL_BINARY)
$(LOCAL_BINARY): $(SOURCES)
. ./scripts/shared_env && ./scripts/build_binary.sh ./bin/local
@echo "Built ecr-login"
.PHONY: test
test:
. ./scripts/shared_env && go test -v -timeout 30s -short -cover $(shell go list ./ecr-login/... | grep -v /vendor/)
.PHONY: all-variants
all-variants: linux-amd64 darwin-amd64 windows-amd64
.PHONY: linux-amd64
linux-amd64: $(LINUX_AMD64_BINARY)
$(LINUX_AMD64_BINARY): $(SOURCES)
./scripts/build_variant.sh linux amd64
.PHONY: darwin-amd64
darwin-amd64: $(DARWIN_AMD64_BINARY)
$(DARWIN_AMD64_BINARY): $(SOURCES)
./scripts/build_variant.sh darwin amd64
.PHONY: windows-amd64
windows-amd64: $(WINDOWS_AMD64_BINARY)
$(WINDOWS_AMD64_BINARY): $(SOURCES)
./scripts/build_variant.sh windows amd64
@mv ./bin/windows-amd64/docker-credential-ecr-login ./bin/windows-amd64/docker-credential-ecr-login.exe
.PHONY: gogenerate
gogenerate:
./scripts/gogenerate
.PHONY: get-deps
get-deps:
go get github.com/tools/godep
go get golang.org/x/tools/cmd/cover
go get github.com/golang/mock/mockgen
go get golang.org/x/tools/cmd/goimports
.PHONY: clean
clean:
rm -rf ./bin ||:
release:
@git tag -af ${VERSION} -m "Release ${VERSION}" && git push -f origin ${VERSION}
@goreleaser --rm-dist