-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
77 lines (56 loc) · 2.09 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
VERSION ?= 1.1.0
CONTAINER_MANAGER ?= podman
# Image URL to use all building/pushing image targets
IMG ?= quay.io/rhqp/podman-desktop-e2e:v${VERSION}
E2E_BINARY ?= pd-e2e
# Tekton task
TKN_IMG ?= quay.io/rhqp/podman-desktop-e2e-tkn:v${VERSION}
BUILD_DIR ?= out
NATIVE_GOARCH := $(shell env -u GOARCH go env GOARCH)
ARCH ?= $(NATIVE_GOARCH)
# https://golang.org/cmd/link/
LDFLAGS := $(VERSION_VARIABLES) -extldflags='-static' ${GO_EXTRA_LDFLAGS}
TOOLS_DIR := tools
include tools/tools.mk
.PHONY: clean
clean:
rm -rf $(BUILD_DIR)
.PHONY: build
build:
go test -v test/e2e/e2e_podman/suite_test.go test/e2e/e2e_podman/podman-extension_test.go -c -o $(BUILD_DIR)/linux-amd64/pd-e2e
# Run golangci-lint against code
.PHONY: lint
lint: $(GOPATH)/bin/golangci-lint
$(GOPATH)/bin/golangci-lint run
$(GOPATH)/bin/golangci-lint:
go install github.com/golangci/golangci-lint/cmd/[email protected]
.PHONY: check
check: build lint
.PHONY: cross
cross: clean $(BUILD_DIR)/windows-amd64/pd-e2e.exe
.PHONY: build-windows
build-windows: clean $(BUILD_DIR)/windows-${ARCH}/pd-e2e.exe
$(BUILD_DIR)/windows-${ARCH}/pd-e2e.exe: $(SOURCES)
CC=clang GOARCH=${ARCH} GOOS=windows go test -v test/e2e/e2e_podman/suite_test.go test/e2e/e2e_podman/podman-extension_test.go \
-c -o $(BUILD_DIR)/windows-${ARCH}/pd-e2e.exe
.PHONY: build-darwin
build-darwin: clean $(BUILD_DIR)/darwin-${ARCH}/pd-e2e
$(BUILD_DIR)/darwin-${ARCH}/pd-e2e:
CGO_ENABLED=1 CC=clang GOARCH=${ARCH} GOOS=darwin go test -v test/e2e/e2e_podman/suite_test.go test/e2e/e2e_podman/podman-extension_test.go \
-c -o $(BUILD_DIR)/darwin-${ARCH}/pd-e2e
.PHONY: vendor
vendor:
go mod tidy
go mod vendor
# Build the container image
.PHONY: oci-build
oci-build:
${CONTAINER_MANAGER} build -t ${IMG}-${OS}-${ARCH} -f oci/Containerfile --build-arg=OS=${OS} --build-arg=ARCH=${ARCH} --build-arg=E2E_BINARY=${E2E_BINARY} oci
# Build the container image
.PHONY: oci-push
oci-push:
${CONTAINER_MANAGER} push ${IMG}-${OS}-${ARCH}
# Create tekton task bundle
.PHONY: tkn-push
tkn-push: install-out-of-tree-tools
$(TOOLS_BINDIR)/tkn bundle push $(TKN_IMG) -f tkn/task.yaml