forked from crumbhole/argocd-lovely-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (48 loc) · 1.7 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
.PHONY: all clean code-vet code-fmt test get docker variations generate code-check
DEPS := $(shell find . -type f -name "*.go" -printf "%p ")
IMAGE_REPO := ghcr.io/crumbhole
BASE_LOVELY_IMAGE := argocd-lovely-plugin-cmp
all: code-vet code-fmt test build/argocd-lovely-plugin
docker: plugin_versioned.yaml
docker build . -t ${IMAGE_REPO}/${BASE_LOVELY_IMAGE}:${LOVELY_VERSION}
variations: docker
BASE_LOVELY_IMAGE=${BASE_LOVELY_IMAGE} IMAGE_REPO=${IMAGE_REPO} LOVELY_VERSION=${LOVELY_VERSION} variations/variations.sh
clean:
$(RM) -rf build
get: $(DEPS)
go get ./...
test: get
go test -timeout 20m ./...
test_verbose: get
go test -timeout 20m -v ./...
generate: config.md .github/actions/variations/action.yaml
code-check: generate code-fmt
git diff --exit-code
.github/actions/variations/action.yaml: variations/variationActions.sh variations/variations.txt
BASE_LOVELY_IMAGE=${BASE_LOVELY_IMAGE} $<
config.md plugin.yaml &: build/generator
$<
plugin_versioned.yaml: plugin.yaml
yq e '.spec.version |= "${LOVELY_VERSION}"' < $< > $@
update:
go get -u ./...
go mod tidy
build/argocd-lovely-plugin: $(DEPS) get
mkdir -p build
CGO_ENABLED=0 go build -buildvcs=false -o build ./cmd/argocd-lovely-plugin/.
build/generator: $(DEPS) get
mkdir -p build
CGO_ENABLED=0 go build -buildvcs=false -o build ./cmd/generator/.
code-vet: $(DEPS) get
## Run go vet for this project. More info: https://golang.org/cmd/vet/
@echo go vet
go vet $$(go list ./... )
code-fmt: $(DEPS) get
## Run go fmt for this project
@echo go fmt
go fmt $$(go list ./... )
lint: $(DEPS) get
golangci-lint run
coverage: $(DEPS) get
go test -timeout 20m -v ./... -coverpkg=./... -coverprofile=coverage.out
go tool cover -html=coverage.out