@@ -10,162 +10,179 @@ on:
1010
1111jobs :
1212 build :
13- name : Test on ${{ matrix.platform }} with Python ${{ matrix.python }}
13+ name : Test on ${{ matrix.platform }} with Python ${{ matrix.python }} with Redis ${{ matrix.redis-version }}
1414 runs-on : ${{ matrix.platform }}
1515 timeout-minutes : 40
1616 strategy :
1717 matrix :
18- platform : ['ubuntu-20 .04', 'macos-11']
18+ platform : ['ubuntu-22 .04', 'macos-11']
1919 python : ['3.7', '3.8', '3.9', '3.10', '3.11']
20+ redis-version : ['7.0', '7.2']
2021 fail-fast : false
2122 defaults :
2223 run :
2324 shell : bash -l -eo pipefail {0}
2425
2526 steps :
26- - uses : actions/checkout@v3
27+ - name : checkout
28+ uses : actions/checkout@v3
2729 # Number of commits to fetch. 0 indicates all history for all branches and tags.
2830 with :
2931 fetch-depth : ' '
3032
33+ - name : clone redis
34+ uses : actions/checkout@v3
35+ # Number of commits to fetch. 0 indicates all history for all branches and tags.
36+ with :
37+ fetch-depth : ' '
38+ repository : ' redis/redis'
39+ ref : ${{matrix.redis-version}}
40+ path : redis
41+
3142 - name : Setup Python
3243 uses : actions/setup-python@v4
3344 with :
3445 python-version : ${{ matrix.python }}
3546 architecture : x64
3647
37- - name : Cache pip
48+ - name : Setup Poetry
49+ uses : snok/install-poetry@v1
50+ with :
51+ version : 1.5.1
52+ virtualenvs-in-project : true
53+ virtualenvs-create : true
54+ installer-parallel : true
55+
56+ - name : Cache poetry
3857 uses : actions/cache@v3
3958 with :
40- path : ~/.cache/pip # This path is specific to Ubuntu
59+ path : ~/.cache/poetry # This path is specific to Ubuntu
4160 # Look to see if there is a cache hit for the corresponding requirements file
4261 key : ${{ matrix.platform }}-${{ matrix.python }}-pyproject.toml-${{ hashFiles('pyproject.toml') }}
4362 restore-keys : |
4463 ${{ matrix.platform }}-${{ matrix.python }}-pyproject.toml-${{hashFiles('pyproject.toml')}}}
4564
46- - name : Setup automation
47- run : |
48- git clone --recursive https://github.com/RedisLabsModules/readies.git
49- ./readies/bin/getpy3
5065
5166 - name : Install Python dependencies
52- run : |
53- python3 -m pip install poetry
54- python3 -m poetry config virtualenvs.create false
55- python3 -m poetry export --dev --without-hashes -o requirements-${{matrix.platform}}-${{matrix.python}}.txt
56- python3 -m pip install -r requirements-${{matrix.platform}}-${{matrix.python}}.txt
67+ run : poetry install -q
5768
58- - name : Install Redis Server test dependencies
59- run : |
60- ./readies/bin/getredis --workdir /tmp/redis -v 7 --keep
61- ln -s /tmp/redis/redis redis
62- redis-server --version
69+ - name : Install Redis Server
70+ working-directory : redis
71+ run : make BUILD_TLS=yes -j `nproc` install
72+
73+ - name : Generate test certificates # this step needs the redis repo to be cloned
74+ working-directory : redis
75+ run : ./utils/gen-test-certs.sh
6376
64- - name : Generate test certificates
77+ - name : Copy certificates to tests/flow
6578 run : |
66- cd redis
67- rm -rf ./tests/unit/tls/
68- ./utils/gen-test-certs.sh
79+ mkdir -p tests/flow/tls
80+ cp redis/tests/tls/redis.crt tests/flow/tls
81+ cp redis/tests/tls/redis.key tests/flow/tls
82+ cp redis/tests/tls/ca.crt tests/flow/tls
6983
7084 - name : Unit Test with pytest
7185 timeout-minutes : 30
7286 run : |
73- TLS="$PWD/redis/ tests/tls"
87+ TLS="tests/flow /tls"
7488 TLS_CERT=$TLS/redis.crt \
7589 TLS_KEY=$TLS/redis.key \
7690 TLS_CACERT=$TLS/ca.crt \
7791 REDIS_BINARY=`command -v redis-server` \
78- pytest --ignore=tests/flow --ignore=test_example.py -v
79-
80- - name : Install RLTest
81- run : |
82- python3 -m pip install .
92+ poetry run pytest --ignore=tests/flow --ignore=test_example.py -v
8393
8494 - name : Flow Test OSS Single Module
95+ working-directory : tests/flow
8596 run : |
86- cd tests/flow
8797 make -C modules
88- CONTAINS_MODULES=1 RLTest --env oss -v --clear-logs --module modules/module1.so
98+ poetry run RLTest --env oss -v --clear-logs --module modules/module1.so --module-args "DUPLICATE_POLICY BLOCK"
8999
90100 - name : Flow Test OSS Multiple Modules --use-slaves
101+ working-directory : tests/flow
102+ if : (success() || failure())
91103 run : |
92- cd tests/flow
93104 make -C modules
94- CONTAINS_MODULES=1 RLTest --env oss -v --clear-logs \
105+ poetry run RLTest --env oss -v --clear-logs \
95106 --module modules/module1.so --module-args '' \
96107 --module modules/module2.so --module-args '' \
97108 --use-slaves
98109
99110 - name : Flow Test OSS Multiple Modules --use-aof
111+ working-directory : tests/flow
112+ if : (success() || failure())
100113 run : |
101- cd tests/flow
102114 make -C modules
103- CONTAINS_MODULES=1 RLTest --env oss -v --clear-logs \
104- --module modules/module1.so --module-args '' \
105- --module modules/module2.so --module-args '' \
106- --use-aof
115+ poetry run RLTest --env oss -v --clear-logs \
116+ --module modules/module1.so --module-args '' \
117+ --module modules/module2.so --module-args '' \
118+ --use-aof
107119
108120 - name : Flow Test OSS Multiple Modules
121+ working-directory : tests/flow
122+ if : (success() || failure())
109123 run : |
110- cd tests/flow
111124 make -C modules
112- CONTAINS_MODULES=1 RLTest --env oss -v --clear-logs \
113- --module modules/module1.so --module-args '' \
114- --module modules/module2.so --module-args ''
125+ poetry run RLTest --env oss -v --clear-logs \
126+ --module modules/module1.so --module-args '' \
127+ --module modules/module2.so --module-args ''
115128
116129 - name : Flow Test OSS-CLUSTER Modules
130+ working-directory : tests/flow
131+ if : (success() || failure())
117132 run : |
118- cd tests/flow
119133 make -C modules
120- CONTAINS_MODULES=1 RLTest --env oss-cluster -v --clear-logs \
121- --module modules/module1.so --module-args '' \
122- --module modules/module2.so --module-args ''
134+ poetry run RLTest --env oss-cluster -v --clear-logs \
135+ --module modules/module1.so --module-args '' \
136+ --module modules/module2.so --module-args ''
123137
124138 - name : Flow Test OSS TCP
125- run : |
126- cd tests/flow
127- RLTest --env oss -v --clear-logs
139+ working-directory : tests/flow
140+ if : (success() || failure())
141+ run : poetry run RLTest --env oss -v --clear-logs
128142
129143 - name : Flow Test OSS UNIX SOCKETS
130- run : |
131- cd tests/flow
132- RLTest --env oss -v --clear-logs
144+ working-directory : tests/flow
145+ if : (success() || failure())
146+ run : poetry run RLTest --env oss -v --clear-logs
133147
134148 - name : Flow Test OSS TCP SLAVES
135- run : |
136- cd tests/flow
137- RLTest --env oss -v --unix --clear-logs
149+ working-directory : tests/flow
150+ if : (success() || failure())
151+ run : poetry run RLTest --env oss -v --unix --clear-logs
138152
139153 - name : Flow Test OSS-CLUSTER TCP
140- run : |
141- cd tests/flow
142- RLTest --env oss-cluster -v --clear-logs --shards-count 3
154+ working-directory : tests/flow
155+ if : (success() || failure())
156+ run : poetry run RLTest --env oss-cluster -v --clear-logs --shards-count 3
143157
144158 - name : Flow Test OSS TCP with TLS
159+ working-directory : tests/flow
160+ if : (success() || failure())
145161 run : |
146- TLS="$PWD/redis/tests/tls"
147- cd tests/flow
148- RLTest --env oss -v --clear-logs \
162+ TLS="tls"
163+ poetry run RLTest --env oss -v --clear-logs \
149164 --tls-cert-file $TLS/redis.crt \
150165 --tls-key-file $TLS/redis.key \
151166 --tls-ca-cert-file $TLS/ca.crt \
152167 --tls
153168
154169 - name : Flow Test OSS-CLUSTER with TLS
170+ working-directory : tests/flow
171+ if : (success() || failure())
155172 run : |
156- TLS="$PWD/redis/tests/tls"
157- cd tests/flow
158- RLTest --env oss-cluster --shards-count 3 -v --clear-logs \
173+ TLS="tls"
174+ poetry run RLTest --env oss-cluster --shards-count 3 -v --clear-logs \
159175 --tls-cert-file $TLS/redis.crt \
160176 --tls-key-file $TLS/redis.key \
161177 --tls-ca-cert-file $TLS/ca.crt \
162178 --tls
163179
164180 - name : Flow Test OSS-CLUSTER with SLAVES and TLS
181+ working-directory : tests/flow
182+ if : (success() || failure())
165183 run : |
166- TLS="$PWD/redis/tests/tls"
167- cd tests/flow
168- RLTest --env oss-cluster --shards-count 3 --use-slaves -v --clear-logs \
184+ TLS="tls"
185+ poetry run RLTest --env oss-cluster --shards-count 3 --use-slaves -v --clear-logs \
169186 --tls-cert-file $TLS/redis.crt \
170187 --tls-key-file $TLS/redis.key \
171188 --tls-ca-cert-file $TLS/ca.crt \
@@ -174,12 +191,12 @@ jobs:
174191 - name : Generate coverage report
175192 if : matrix.python == '3.9' && matrix.platform != 'macos-11'
176193 run : |
177- TLS="$PWD/redis/ tests/tls"
194+ TLS="tests/flow /tls"
178195 TLS_CERT=$TLS/redis.crt \
179196 TLS_KEY=$TLS/redis.key \
180197 TLS_CACERT=$TLS/ca.crt \
181198 REDIS_BINARY=`command -v redis-server` \
182- pytest --ignore=tests/flow --ignore=test_example.py --cov-config=.coveragerc --cov-report=xml --cov=RLTest
199+ poetry run pytest --ignore=tests/flow --ignore=test_example.py --cov-config=.coveragerc --cov-report=xml --cov=RLTest
183200
184201 - name : Upload coverage to Codecov
185202 uses : codecov/codecov-action@v3
0 commit comments