forked from Qihoo360/pink
-
Notifications
You must be signed in to change notification settings - Fork 2
121 lines (103 loc) · 4.03 KB
/
build_test_push.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Run Redis benchmark on Rondis
on:
pull_request:
# Launch on PRs *towards* these branches
branches:
- main
- master
types: [opened, synchronize, reopened]
jobs:
build-pink-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: brew install protobuf
- name: Build
run: cd pink && make static_lib
build-and-run-redis-benchmark:
needs: [build-pink-macos]
runs-on: ubuntu-latest
env:
RONDB_VERSION: 24.10.0
RONDB_TARBALL_URI: https://repo.hops.works/master/rondb-24.10.0-linux-glibc2.28-x86_64.tar.gz
RONDB_DOCKER_DIR: /tmp/rondb-docker
RONDB_TARBALL_FILE: rondb.tar.gz
RONDB_PATH: /tmp/rondb
IMAGE_NAME: rondis:latest
CONTAINER_NAME: rondis
RONDIS_PORT: 6379
DOCKER_WORK_DIR: /usr/src/app
LOCAL_RONDIS_LOG: /tmp/rondis_server.log
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Clone rondb-docker
run: git clone -b release-0.7 https://github.com/logicalclocks/rondb-docker.git $RONDB_DOCKER_DIR
- name: Download RonDB
run: |
wget $RONDB_TARBALL_URI -O $RONDB_DOCKER_DIR/$RONDB_TARBALL_FILE
mkdir -p $RONDB_PATH
tar xfz $RONDB_DOCKER_DIR/$RONDB_TARBALL_FILE -C $RONDB_PATH --strip-components=1
- name: Run rondb-docker
run: |
cd $RONDB_DOCKER_DIR
# The script expects a relative path to the tarball
./build_run_docker.sh -d \
--rondb-tarball-path ./$RONDB_TARBALL_FILE \
--rondb-version $RONDB_VERSION \
--size small \
--num-mgm-nodes 1 \
--node-groups 1 \
--replication-factor 1 \
--num-mysql-nodes 1 \
--num-rest-api-nodes 0 \
--num-benchmarking-nodes 0
- name: Build Rondis image
run: docker build -t $IMAGE_NAME .
- name: Create Rondis environment
run: |
docker run -d \
--name=$CONTAINER_NAME \
-v $RONDB_PATH:$RONDB_PATH \
-v $(pwd):$DOCKER_WORK_DIR \
-e RONDB_PATH=$RONDB_PATH \
-w $DOCKER_WORK_DIR \
-p $RONDIS_PORT:$RONDIS_PORT \
$IMAGE_NAME \
tail -f /dev/null
- name: Build Pink
run: docker exec -i $CONTAINER_NAME bash -c "cd pink && ./build.sh"
- name: Run SQL scripts
run: |
docker exec -i mysqld_1 bash -c "mysql -uroot -e 'CREATE DATABASE redis;'"
for sql_file in pink/rondis/sql/*.sql; do
cat "$sql_file" | docker exec -i mysqld_1 mysql -uroot --database=redis
done
- name: Connect Docker network
run: |
# Get network name that starts with "rondb"
COMPOSE_NETWORK=$(docker network list | grep rondb | awk '{print $2}')
docker network connect $COMPOSE_NETWORK $CONTAINER_NAME
- name: Run Rondis server
run: |
docker exec -w $DOCKER_WORK_DIR -e LD_LIBRARY_PATH=/tmp/rondb/lib \
-t $CONTAINER_NAME pink/rondis/rondis 6379 mgmd_1:1186 2 > $LOCAL_RONDIS_LOG &
# Takes a few seconds before all connections are setup and started properly
- name: Wait for Rondis server to start properly
run: sleep 5
# Running this multiple times to check for memory leaks and that overwrites/updates/deletes work
- name: Run tests multiple times
run: |
for i in {1..50}; do
docker exec -w $DOCKER_WORK_DIR -i $CONTAINER_NAME bash -c \
"pink/rondis/tests/get_set.sh $((i % 3))"
docker exec -w $DOCKER_WORK_DIR -i $CONTAINER_NAME bash -c \
"pink/rondis/tests/hget_hset.sh $((i % 5)) $((i % 3))"
echo "Success in run $i"
done
- name: Run Redis benchmark
run: docker exec -i $CONTAINER_NAME bash -c "redis-benchmark -t get,set,incr,hget,hset,hincr -r 100 -P 10 --threads 3"
- name: Show Rondis logs
if: always()
run: cat $LOCAL_RONDIS_LOG