Skip to content

Commit 72133e9

Browse files
committed
Make improvements
- removed reduntant integration Makefile - changed "integration" target to run only integration tests this should speed up CI tests because they wont run unit tests twice (in `testrace` and again in `int` target) - added help target to list available targets to be used by user - added target to download and build redis server server will be downloaded and build if it's not available when version in get_redis.sh will be changed new server will be downloaded and build automatically even if previous version was available locally Signed-off-by: Wojciech Szarański <wojciech.szaranski@gmail.com>
1 parent 1ed5626 commit 72133e9

File tree

4 files changed

+28
-16
lines changed

4 files changed

+28
-16
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,5 @@ jobs:
1616
- uses: actions/setup-go@v4
1717
with:
1818
go-version: ${{ matrix.go }}
19-
- name: Install Redis
20-
run: (cd ./integration && ./get_redis.sh)
2119
- name: Test
2220
run: make int testrace

Makefile

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
1-
.PHONY: all test testrace int
1+
.PHONY: help
2+
help: ### This screen. Keep it first target to be default
3+
ifeq ($(UNAME), Linux)
4+
@grep -P '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
5+
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
6+
else
7+
@# this is not tested, but prepared in advance for you, Mac drivers
8+
@awk -F ':.*###' '$$0 ~ FS {printf "%15s%s\n", $$1 ":", $$2}' \
9+
$(MAKEFILE_LIST) | grep -v '@awk' | sort
10+
endif
211

3-
all: test
4-
5-
test:
12+
.PHONY: test
13+
test: ### Run unit tests
614
go test ./...
715

8-
testrace:
16+
.PHONY: testrace
17+
testrace: ### Run unit tests with race detector
918
go test -race ./...
1019

11-
int:
12-
INT=1 go test ./...
20+
.PHONY: int
21+
int: integration/redis_src/redis-server ### Run integration tests
22+
INT=1 go test ./integration/...
23+
24+
integration/redis_src/redis-server: integration/get_redis.sh ### Download and build redis if not available or in wrong version
25+
./integration/get_redis.sh
26+
27+
.PHONY: clean
28+
clean: ### Cleanup integration test files (including built redis binary)
29+
rm -rf \
30+
integration/redis_src \
31+
integration/dump.rdb \
32+
integration/nodes.conf

integration/Makefile

Lines changed: 0 additions & 7 deletions
This file was deleted.

integration/get_redis.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -eu
44

55
VERSION=7.2.0
66

7+
cd "$(dirname "$0")"
78
rm -rf ./redis_src/
89
mkdir -p ./redis_src/
910
cd ./redis_src/

0 commit comments

Comments
 (0)