-
Notifications
You must be signed in to change notification settings - Fork 413
214 lines (182 loc) · 6.87 KB
/
test.yml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master, next]
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
coverage:
runs-on: ubuntu-latest
name: coverage for node@lts, redis@7
env:
node-version: lts/*
redis-version: 7-alpine
allowed_coverage_change: -0.25
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Use Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
with:
node-version: ${{ env.node-version }}
cache: 'yarn'
- name: Start Redis
uses: supercharge/redis-github-action@f63fe516254d0af5df91755a4488274c2e71e38c # 1.5.0
with:
redis-version: ${{ env.redis-version }}
- run: yarn install --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn coverage
- name: Upload LCOV to Coveralls
if: ${{ ( github.event_name == 'pull_request' && github.event.pull_request.head.fork == false ) || github.event_name == 'push' }}
uses: coverallsapp/github-action@95b1a2355bd0e526ad2fd62da9fd386ad4c98474 # branch=master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check coverage change not below threshold
shell: bash
run: |
sleep 2
COVERAGE_CHANGE=$(curl -s https://coveralls.io/builds/${{ github.sha }}.json | jq '.coverage_change')
echo coverage changed by ${COVERAGE_CHANGE}%
if [[ -z "$(echo ${COVERAGE_CHANGE} ${{ env.allowed_coverage_change }} | awk '$1 >= $2')" ]]; then
echo current coverage change ${COVERAGE_CHANGE}% below threshold ${{ env.allowed_coverage_change }}%
exit 1
fi
node-redis:
runs-on: ubuntu-latest
name: testing node@${{ matrix.node-version }}, redis@${{ matrix.redis-version }}
strategy:
matrix:
node-version: [current, lts/*, lts/-1, lts/-2]
redis-version: [7-alpine]
include:
- node-version: 'lts/*'
redis-version: 6-alpine
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Start Redis
uses: supercharge/redis-github-action@f63fe516254d0af5df91755a4488274c2e71e38c # 1.5.0
with:
redis-version: ${{ matrix.redis-version }}
- run: yarn install --ignore-engines --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn test
node-valkey:
runs-on: ubuntu-latest
env:
node-version: lts/*
name: testing node@lts/*, valkey@8
services:
valkey:
image: valkey/valkey:8-alpine3.20
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v3 # v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
with:
node-version: lts/*
cache: 'yarn'
- run: yarn install --ignore-engines --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn test
node-dragonflydb:
runs-on: ubuntu-latest
env:
node-version: lts/*
name: testing node@lts/*, dragonflydb@latest
services:
dragonflydb:
image: docker.dragonflydb.io/dragonflydb/dragonfly:v1.24.0
env:
DFLY_cluster_mode: emulated
DFLY_lock_on_hashtags: true
HEALTHCHECK_PORT: 6379
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v3 # v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
with:
node-version: lts/*
cache: 'yarn'
- run: yarn install --ignore-engines --frozen-lockfile --non-interactive
- run: yarn build
- run: BULLMQ_TEST_PREFIX={b} yarn test
# node-upstash:
# runs-on: ubuntu-latest
# continue-on-error: true
# env:
# node-version: lts/*
# REDIS_HOST: ${{ secrets.REDIS_HOST }}
# name: testing node@lts/*, upstash@latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3 # v3
# - name: Use Node.js ${{ env.node-version }}
# uses: actions/setup-node@v3 # v3
# with:
# node-version: lts/*
# cache: 'yarn'
# - run: yarn install --ignore-engines --frozen-lockfile --non-interactive
# - run: yarn build
# - run: yarn test
python:
runs-on: ubuntu-latest
name: testing python@${{ matrix.python-version }}, redis@${{ matrix.redis-version }}
strategy:
matrix:
node-version: [lts/*]
redis-version: [7-alpine]
python-version: ['3.10']
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Start Redis
uses: supercharge/redis-github-action@f63fe516254d0af5df91755a4488274c2e71e38c # 1.5.0
with:
redis-version: ${{ matrix.redis-version }}
- run: yarn install --ignore-engines --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn copy:lua:python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 mypy types-redis
pip install -r python/requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 ./python --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./python --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
cd python
./run_tests.sh