mirror of
https://github.com/redis/go-redis.git
synced 2025-04-16 09:23:06 +03:00
* introduce github workflow for ci similar to the one in redis-py use prerelease for 8.0-M4 * Enable osscluster tests in CI * Add redis major version env Enable filtering test per redis major version Fix test for FT.SEARCH WITHSCORE, the default scorer has changed. fix Makefile syntax remove filter from github action fix makefile use the container name in Makefile * remove 1.20 from doctests * self review, cleanup, add comments * add comments, reorder prints, add default value for REDIS_MAJOR_VERSION
54 lines
1.7 KiB
Makefile
54 lines
1.7 KiB
Makefile
GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
|
|
export REDIS_MAJOR_VERSION := 7
|
|
|
|
test: testdeps
|
|
docker start go-redis-redis-stack || docker run -d --name go-redis-redis-stack -p 6379:6379 -e REDIS_ARGS="--enable-debug-command yes --enable-module-command yes" redis/redis-stack-server:latest
|
|
$(eval GO_VERSION := $(shell go version | cut -d " " -f 3 | cut -d. -f2))
|
|
set -e; for dir in $(GO_MOD_DIRS); do \
|
|
if echo "$${dir}" | grep -q "./example" && [ "$(GO_VERSION)" = "19" ]; then \
|
|
echo "Skipping go test in $${dir} due to Go version 1.19 and dir contains ./example"; \
|
|
continue; \
|
|
fi; \
|
|
echo "go test in $${dir}"; \
|
|
(cd "$${dir}" && \
|
|
go mod tidy -compat=1.18 && \
|
|
go test && \
|
|
go test ./... -short -race && \
|
|
go test ./... -run=NONE -bench=. -benchmem && \
|
|
env GOOS=linux GOARCH=386 go test && \
|
|
go test -coverprofile=coverage.txt -covermode=atomic ./... && \
|
|
go vet); \
|
|
done
|
|
cd internal/customvet && go build .
|
|
go vet -vettool ./internal/customvet/customvet
|
|
docker stop go-redis-redis-stack
|
|
|
|
testdeps: testdata/redis/src/redis-server
|
|
|
|
bench: testdeps
|
|
go test ./... -test.run=NONE -test.bench=. -test.benchmem
|
|
|
|
.PHONY: all test testdeps bench fmt
|
|
|
|
build:
|
|
go build .
|
|
|
|
testdata/redis:
|
|
mkdir -p $@
|
|
wget -qO- https://download.redis.io/releases/redis-7.4.2.tar.gz | tar xvz --strip-components=1 -C $@
|
|
|
|
testdata/redis/src/redis-server: testdata/redis
|
|
cd $< && make all
|
|
|
|
fmt:
|
|
gofumpt -w ./
|
|
goimports -w -local github.com/redis/go-redis ./
|
|
|
|
go_mod_tidy:
|
|
set -e; for dir in $(GO_MOD_DIRS); do \
|
|
echo "go mod tidy in $${dir}"; \
|
|
(cd "$${dir}" && \
|
|
go get -u ./... && \
|
|
go mod tidy -compat=1.18); \
|
|
done
|