forked from aws/amazon-ecs-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
107 lines (89 loc) · 3.4 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Copyright 2015-2017 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)
all: build
SOURCEDIR := ./ecs-cli
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
LOCAL_BINARY := bin/local/ecs-cli
LINUX_BINARY := bin/linux-amd64/ecs-cli
DARWIN_BINARY := bin/darwin-amd64/ecs-cli
WINDOWS_BINARY := bin/windows-amd64/ecs-cli.exe
LOCAL_PATH := $(ROOT)/scripts:${PATH}
DEP_RELEASE_TAG := v0.4.1
.PHONY: build
build: $(LOCAL_BINARY)
$(LOCAL_BINARY): $(SOURCES)
./scripts/build_binary.sh ./bin/local
@echo "Built ecs-cli"
.PHONY: test
test:
env -i PATH=$$PATH GOPATH=$$GOPATH GOROOT=$$GOROOT GOCACHE=$$GOCACHE go test -timeout=120s -v -cover ./ecs-cli/modules/...
.PHONY: integ-test
integ-test:
@echo "Building ecs-cli..."
./scripts/build_binary.sh ./bin/local
@echo "Running integration tests..."
go test -tags integ -v ./ecs-cli/integ/...
.PHONY: generate
generate: $(SOURCES)
PATH=$(LOCAL_PATH) go generate ./ecs-cli/modules/...
.PHONY: generate-deps
generate-deps:
DEP_RELEASE_TAG=$DEP_RELEASE_TAG
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
go get github.com/golang/mock/mockgen
go get golang.org/x/tools/cmd/goimports
.PHONY: windows-build
windows-build: $(WINDOWS_BINARY)
.PHONY: docker-build
docker-build:
docker run -v $(shell pwd):/usr/src/app/src/github.com/aws/amazon-ecs-cli \
--workdir=/usr/src/app/src/github.com/aws/amazon-ecs-cli \
--env GOPATH=/usr/src/app \
--env ECS_RELEASE=$(ECS_RELEASE) \
golang:1.11 make $(LINUX_BINARY)
docker run -v $(shell pwd):/usr/src/app/src/github.com/aws/amazon-ecs-cli \
--workdir=/usr/src/app/src/github.com/aws/amazon-ecs-cli \
--env GOPATH=/usr/src/app \
--env ECS_RELEASE=$(ECS_RELEASE) \
golang:1.11 make $(DARWIN_BINARY)
docker run -v $(shell pwd):/usr/src/app/src/github.com/aws/amazon-ecs-cli \
--workdir=/usr/src/app/src/github.com/aws/amazon-ecs-cli \
--env GOPATH=/usr/src/app \
--env ECS_RELEASE=$(ECS_RELEASE) \
golang:1.11 make $(WINDOWS_BINARY)
.PHONY: docker-test
docker-test:
docker run -v $(shell pwd):/usr/src/app/src/github.com/aws/amazon-ecs-cli \
--workdir=/usr/src/app/src/github.com/aws/amazon-ecs-cli \
--env GOPATH=/usr/src/app \
--env ECS_RELEASE=$(ECS_RELEASE) \
golang:1.11 make test
.PHONY: supported-platforms
supported-platforms: $(LINUX_BINARY) $(DARWIN_BINARY) $(WINDOWS_BINARY)
$(WINDOWS_BINARY): $(SOURCES)
@mkdir -p ./bin/windows-amd64
TARGET_GOOS=windows GOARCH=amd64 ./scripts/build_binary.sh ./bin/windows-amd64
mv ./bin/windows-amd64/ecs-cli ./bin/windows-amd64/ecs-cli.exe
@echo "Built ecs-cli.exe for windows"
$(LINUX_BINARY): $(SOURCES)
@mkdir -p ./bin/linux-amd64
TARGET_GOOS=linux GOARCH=amd64 ./scripts/build_binary.sh ./bin/linux-amd64
@echo "Built ecs-cli for linux"
$(DARWIN_BINARY): $(SOURCES)
@mkdir -p ./bin/darwin-amd64
TARGET_GOOS=darwin GOARCH=amd64 ./scripts/build_binary.sh ./bin/darwin-amd64
@echo "Built ecs-cli for darwin"
.PHONY: clean
clean:
rm -rf ./bin/ ||: