...

Text file src/github.com/redis/go-redis/v9/Makefile

Documentation: github.com/redis/go-redis/v9

     1GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
     2REDIS_VERSION ?= 8.2
     3RE_CLUSTER ?= false
     4RCE_DOCKER ?= true
     5CLIENT_LIBS_TEST_IMAGE ?= redislabs/client-libs-test:8.2.1-pre
     6
     7docker.start:
     8	export RE_CLUSTER=$(RE_CLUSTER) && \
     9	export RCE_DOCKER=$(RCE_DOCKER) && \
    10	export REDIS_VERSION=$(REDIS_VERSION) && \
    11	export CLIENT_LIBS_TEST_IMAGE=$(CLIENT_LIBS_TEST_IMAGE) && \
    12	docker compose --profile all up -d --quiet-pull
    13
    14docker.stop:
    15	docker compose --profile all down
    16
    17test:
    18	$(MAKE) docker.start
    19	@if [ -z "$(REDIS_VERSION)" ]; then \
    20		echo "REDIS_VERSION not set, running all tests"; \
    21		$(MAKE) test.ci; \
    22	else \
    23		MAJOR_VERSION=$$(echo "$(REDIS_VERSION)" | cut -d. -f1); \
    24		if [ "$$MAJOR_VERSION" -ge 8 ]; then \
    25			echo "REDIS_VERSION $(REDIS_VERSION) >= 8, running all tests"; \
    26			$(MAKE) test.ci; \
    27		else \
    28			echo "REDIS_VERSION $(REDIS_VERSION) < 8, skipping vector_sets tests"; \
    29			$(MAKE) test.ci.skip-vectorsets; \
    30		fi; \
    31	fi
    32	$(MAKE) docker.stop
    33
    34test.ci:
    35	set -e; for dir in $(GO_MOD_DIRS); do \
    36	  echo "go test in $${dir}"; \
    37	  (cd "$${dir}" && \
    38	    export RE_CLUSTER=$(RE_CLUSTER) && \
    39	    export RCE_DOCKER=$(RCE_DOCKER) && \
    40	    export REDIS_VERSION=$(REDIS_VERSION) && \
    41	    go mod tidy -compat=1.18 && \
    42	    go vet && \
    43	    go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race -skip Example); \
    44	done
    45	cd internal/customvet && go build .
    46	go vet -vettool ./internal/customvet/customvet
    47
    48test.ci.skip-vectorsets:
    49	set -e; for dir in $(GO_MOD_DIRS); do \
    50	  echo "go test in $${dir} (skipping vector sets)"; \
    51	  (cd "$${dir}" && \
    52	    export RE_CLUSTER=$(RE_CLUSTER) && \
    53	    export RCE_DOCKER=$(RCE_DOCKER) && \
    54	    export REDIS_VERSION=$(REDIS_VERSION) && \
    55	    go mod tidy -compat=1.18 && \
    56	    go vet && \
    57	    go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race \
    58	      -run '^(?!.*(?:VectorSet|vectorset|ExampleClient_vectorset)).*$$' -skip Example); \
    59	done
    60	cd internal/customvet && go build .
    61	go vet -vettool ./internal/customvet/customvet
    62
    63bench:
    64	export RE_CLUSTER=$(RE_CLUSTER) && \
    65	export RCE_DOCKER=$(RCE_DOCKER) && \
    66	export REDIS_VERSION=$(REDIS_VERSION) && \
    67	go test ./... -test.run=NONE -test.bench=. -test.benchmem -skip Example
    68
    69.PHONY: all test test.ci test.ci.skip-vectorsets bench fmt
    70
    71build:
    72	export RE_CLUSTER=$(RE_CLUSTER) && \
    73	export RCE_DOCKER=$(RCE_DOCKER) && \
    74	export REDIS_VERSION=$(REDIS_VERSION) && \
    75	go build .
    76
    77fmt:
    78	gofumpt -w ./
    79	goimports -w  -local github.com/redis/go-redis ./
    80
    81go_mod_tidy:
    82	set -e; for dir in $(GO_MOD_DIRS); do \
    83	  echo "go mod tidy in $${dir}"; \
    84	  (cd "$${dir}" && \
    85	    go get -u ./... && \
    86	    go mod tidy -compat=1.18); \
    87	done

View as plain text