Debian Codegraph @

Makefile

raw symbols SCIP
1 .DEFAULT_GOAL := build
2
3 DOCKER_COMPOSE := $(if $(shell which docker-compose),docker-compose,docker compose)
4
5 .PHONY: build
6 build:
7 go build .
8
9
10 .PHONY: docker-all
11 docker-all: docker-env-up docker-test docker-env-down
12
13
14 .PHONY: docker-env-up
15 docker-env-up:
16 $(DOCKER_COMPOSE) -f docker-compose.yml up -d
17
18
19 .PHONY: docker-env-down
20 docker-env-down:
21 $(DOCKER_COMPOSE) -f docker-compose.yml down
22
23
24 .PHONY: docker-test
25 docker-test:
26 $(DOCKER_COMPOSE) -f docker-compose.yml up -d
27 $(DOCKER_COMPOSE) -f docker-compose.yml run --rm tests bash -c 'make test'
28
29
30 .PHONY: test-certs
31 test-certs:
32 contrib/tls/gen-test-certs.sh
33
34
35 .PHONY: test
36 test:
37 TEST_REDIS_URI="redis://localhost:6379" \
38 TEST_VALKEY7_URI="valkey://localhost:16384" \
39 TEST_VALKEY8_URI="valkey://localhost:16382" \
40 TEST_VALKEY8_BUNDLE_URI="valkey://localhost:16389" \
41 TEST_VALKEY8_TLS_URI="valkeys://localhost:16386" \
42 TEST_REDIS7_TLS_URI="rediss://localhost:16387" \
43 TEST_REDIS8_URI="redis://localhost:16388" \
44 TEST_REDIS88_URI="redis://localhost:16488" \
45 TEST_REDIS7_URI="redis://localhost:16385" \
46 TEST_REDIS5_URI="redis://localhost:16383" \
47 TEST_REDIS6_URI="redis://localhost:16379" \
48 TEST_KEYDB01_URI="redis://localhost:16401" \
49 TEST_KEYDB02_URI="redis://localhost:16402" \
50 TEST_PWD_REDIS_URI="redis://:redis-password@localhost:16380" \
51 TEST_USER_PWD_REDIS_URI="redis://exporter:exporter-password@localhost:16390" \
52 TEST_REDIS_CLUSTER_MASTER_URI="redis://localhost:17000" \
53 TEST_REDIS88_CLUSTER_MASTER_URI="redis://localhost:47000" \
54 TEST_REDIS_CLUSTER_SLAVE_URI="redis://localhost:17005" \
55 TEST_VALKEY_CLUSTER_PASSWORD_URI="redis://localhost:17006" \
56 TEST_TILE38_URI="redis://localhost:19851" \
57 TEST_VALKEY_SENTINEL_URI="redis://localhost:26379" \
58 go test -v -covermode=atomic -cover -race -coverprofile=coverage.txt -p 1 ./...
59
60 .PHONY: lint
61 lint:
62 #
63 # this will run the default linters on non-test files
64 # and then all but the "errcheck" linters on the tests
65 golangci-lint run --tests=false --exclude-use-default
66 golangci-lint run -D=errcheck --exclude-use-default
67
68 .PHONY: checks
69 checks:
70 go vet ./...
71 echo "checking gofmt"
72 @if [ "$(shell gofmt -e -l . | wc -l)" -ne 0 ]; then exit 1; fi
73 echo "checking gofmt - DONE"
74
75 .PHONY: mixin
76 mixin:
77 cd contrib/redis-mixin && \
78 $(MAKE) all && \
79 cd ../../
80
81
82 BUILD_DT:=$(shell date +%F-%T)
83 GO_LDFLAGS:="-s -w -extldflags \"-static\" -X main.BuildVersion=${GITHUB_REF_NAME} -X main.BuildCommitSha=${GITHUB_SHA} -X main.BuildDate=$(BUILD_DT)"
84
85
86 .PHONY: build-some-amd64-binaries
87 build-some-amd64-binaries:
88 go install github.com/oliver006/gox@master
89
90 rm -rf .build | true
91
92 export CGO_ENABLED=0 ; \
93 gox -os="linux windows" -arch="amd64" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${GITHUB_REF_NAME}.{{.OS}}-{{.Arch}}/{{.Dir}}" && echo "done"
94
95
96 .PHONY: build-all-binaries
97 build-all-binaries:
98 go install github.com/oliver006/gox@master
99
100 rm -rf .build | true
101
102 export CGO_ENABLED=0 ; \
103 gox -os="linux windows freebsd netbsd openbsd" -arch="amd64 386" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${GITHUB_REF_NAME}.{{.OS}}-{{.Arch}}/{{.Dir}}" && \
104 gox -os="darwin solaris illumos" -arch="amd64" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${GITHUB_REF_NAME}.{{.OS}}-{{.Arch}}/{{.Dir}}" && \
105 gox -os="darwin" -arch="arm64" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${GITHUB_REF_NAME}.{{.OS}}-{{.Arch}}/{{.Dir}}" && \
106 gox -os="linux freebsd netbsd" -arch="arm" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${GITHUB_REF_NAME}.{{.OS}}-{{.Arch}}/{{.Dir}}" && \
107 gox -os="linux" -arch="arm64 mips64 mips64le ppc64 ppc64le s390x" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${GITHUB_REF_NAME}.{{.OS}}-{{.Arch}}/{{.Dir}}" && \
108 echo "done"