-
Notifications
You must be signed in to change notification settings - Fork 225
/
Makefile
91 lines (69 loc) · 2.48 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
GO_FILES?=$$(find . -name '*.go' |grep -v vendor)
TAG?=latest
.GIT_COMMIT=$(shell git rev-parse HEAD)
.GIT_VERSION=$(shell git describe --tags 2>/dev/null || echo "$(.GIT_COMMIT)")
.GIT_UNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no)
ifneq ($(.GIT_UNTRACKEDCHANGES),)
.GIT_COMMIT := $(.GIT_COMMIT)-dirty
endif
export GOFLAGS=-mod=vendor
.PHONY: build
build:
./build.sh
.PHONY: build_redist
build_redist:
./extract_binaries.sh
.PHONY: build_samples
build_samples:
./build_samples.sh
.PHONY: local-fmt
local-fmt:
gofmt -l -d $(GO_FILES)
.PHONY: local-goimports
local-goimports:
goimports -w $(GO_FILES)
.PHONY: local-install
local-install:
CGO_ENABLED=0 go install --ldflags "-s -w \
-X github.com/openfaas/faas-cli/version.GitCommit=${.GIT_COMMIT} \
-X github.com/openfaas/faas-cli/version.Version=${.GIT_VERSION}" \
.PHONY: dist
dist:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build --ldflags "-s -w \
-X github.com/openfaas/faas-cli/version.GitCommit=${.GIT_COMMIT} \
-X github.com/openfaas/faas-cli/version.Version=${.GIT_VERSION}" \
-o ./bin/faas-cli
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build --ldflags "-s -w \
-X github.com/openfaas/faas-cli/version.GitCommit=${.GIT_COMMIT} \
-X github.com/openfaas/faas-cli/version.Version=${.GIT_VERSION}" \
-o ./bin/faas-cli-darwin
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build --ldflags "-s -w \
-X github.com/openfaas/faas-cli/version.GitCommit=${.GIT_COMMIT} \
-X github.com/openfaas/faas-cli/version.Version=${.GIT_VERSION}" \
-o ./bin/faas-cli-darwin-arm64
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build --ldflags "-s -w \
-X github.com/openfaas/faas-cli/version.GitCommit=${.GIT_COMMIT} \
-X github.com/openfaas/faas-cli/version.Version=${.GIT_VERSION}" \
-o ./bin/faas-cli.exe
.PHONY: test-unit
test-unit:
go test $(shell go list ./... | grep -v /vendor/ | grep -v /template/ | grep -v build) -cover
.PHONY: ci-armhf-push
ci-armhf-push:
(docker push openfaas/faas-cli:$(TAG)-armhf && docker push openfaas/faas-cli:$(TAG)-root-armhf)
.PHONY: ci-armhf-build
ci-armhf-build:
(./build.sh $(TAG)-armhf)
.PHONY: ci-arm64-push
ci-arm64-push:
(docker push openfaas/faas-cli:$(TAG)-arm64 && docker push openfaas/faas-cli:$(TAG)-root-arm64)
.PHONY: ci-arm64-build
ci-arm64-build:
(./build.sh $(TAG)-arm64)
.PHONY: test-templating
PORT?=38080
FUNCTION?=templating-test-func
FUNCTION_UP_TIMEOUT?=30
.EXPORT_ALL_VARIABLES:
test-templating:
./build_integration_test.sh