forked from apache/apisix-ingress-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (68 loc) · 2.87 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
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
#
default: help
VERSION ?= 0.0.0
IMAGE_TAG ?= "latest"
GITSHA ?= $(shell git rev-parse --short=7 HEAD)
OSNAME ?= $(shell uname -s | tr A-Z a-z)
OSARCH ?= $(shell uname -m | tr A-Z a-z)
PWD ?= $(shell pwd)
ifeq ($(OSARCH), x86_64)
OSARCH = amd64
endif
VERSYM="github.com/api7/ingress-controller/pkg/version._buildVersion"
GITSHASYM="github.com/api7/ingress-controller/pkg/version._buildGitRevision"
BUILDOSSYM="github.com/api7/ingress-controller/pkg/version._buildOS"
GO_LDFLAGS ?= "-X=$(VERSYM)=$(VERSION) -X=$(GITSHASYM)=$(GITSHA) -X=$(BUILDOSSYM)=$(OSNAME)/$(OSARCH)"
### build: Build apisix-ingress-controller
build:
go build \
-o apisix-ingress-controller \
-ldflags $(GO_LDFLAGS) \
main.go
### build-image: Build apisix-ingress-controller image
build-image:
docker build -t apisix-ingress-controller:$(IMAGE_TAG) .
### lint: Do static lint check
lint:
golangci-lint run
### gofmt: Format all go codes
gofmt:
find . -type f -name "*.go" | xargs gofmt -w -s
### unit-test: Run unit test cases
unit-test:
go test -cover -coverprofile=coverage.txt ./...
### e2e-test: Run e2e test cases
e2e-test:
export APISIX_ROUTE_DEF=$(PWD)/samples/deploy/crd/v1beta1/ApisixRoute.yaml && \
export APISIX_UPSTREAM_DEF=$(PWD)/samples/deploy/crd/v1beta1/ApisixUpstream.yaml && \
export APISIX_SERVICE_DEF=$(PWD)/samples/deploy/crd/v1beta1/ApisixService.yaml && \
export APISIX_TLS_DEF=$(PWD)/samples/deploy/crd/v1beta1/ApisixTls.yaml && \
cd test/e2e && ginkgo -cover -coverprofile=coverage.txt -r --randomizeSuites --randomizeAllSpecs --trace
### license-check: Do Apache License Header check
license-check:
ifeq ("$(wildcard .actions/openwhisk-utilities/scancode/scanCode.py)", "")
git clone https://github.com/apache/openwhisk-utilities.git .actions/openwhisk-utilities
cp .actions/ASF* .actions/openwhisk-utilities/scancode/
endif
.actions/openwhisk-utilities/scancode/scanCode.py --config .actions/ASF-Release.cfg ./
### help: Show Makefile rules
help:
@echo Makefile rules:
@echo
@grep -E '^### [-A-Za-z0-9_]+:' Makefile | sed 's/###/ /'
.PHONY: build lint help