Skip to content

Commit bdb19f5

Browse files
committed
chore: extract benchmark tests
1 parent 40e049e commit bdb19f5

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

.github/workflows/build.yml

+21
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,27 @@ jobs:
3535
with:
3636
files: coverage.txt
3737
token: ${{ secrets.CODECOV_TOKEN }}
38+
39+
benchmark:
40+
name: benchmark
41+
runs-on: ubuntu-latest
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
go-version: [1.21.x, 1.23.x]
46+
47+
steps:
48+
- name: Set up ${{ matrix.go-version }}
49+
uses: actions/setup-go@v5
50+
with:
51+
go-version: ${{ matrix.go-version }}
52+
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Benchmark Tests
57+
run: make bench
58+
3859

3960
test-redis-ce:
4061
name: test-redis-ce

Makefile

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
22
export REDIS_MAJOR_VERSION := 7
33

4-
test: testdeps
4+
redisstackdocker.start:
55
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
6+
7+
redisstackdocker.stop:
8+
docker stop go-redis-redis-stack
9+
10+
test: testdeps
11+
$(MAKE) redisstackdocker.start
612
$(eval GO_VERSION := $(shell go version | cut -d " " -f 3 | cut -d. -f2))
713
set -e; for dir in $(GO_MOD_DIRS); do \
814
if echo "$${dir}" | grep -q "./example" && [ "$(GO_VERSION)" = "19" ]; then \
@@ -14,19 +20,20 @@ test: testdeps
1420
go mod tidy -compat=1.18 && \
1521
go test && \
1622
go test ./... -short -race && \
17-
go test ./... -run=NONE -bench=. -benchmem && \
1823
env GOOS=linux GOARCH=386 go test && \
1924
go test -coverprofile=coverage.txt -covermode=atomic ./... && \
2025
go vet); \
2126
done
2227
cd internal/customvet && go build .
2328
go vet -vettool ./internal/customvet/customvet
24-
docker stop go-redis-redis-stack
29+
$(MAKE) redisstackdocker.stop
2530

2631
testdeps: testdata/redis/src/redis-server
2732

28-
bench: testdeps
33+
bench:
34+
$(MAKE) redisstackdocker.start
2935
go test ./... -test.run=NONE -test.bench=. -test.benchmem
36+
$(MAKE) redisstackdocker.stop
3037

3138
.PHONY: all test testdeps bench fmt
3239

0 commit comments

Comments
 (0)