-
-
Notifications
You must be signed in to change notification settings - Fork 49
139 lines (135 loc) · 4.06 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
---
name: Unit tests
on:
push:
branches:
- master
pull_request_target:
branches:
- master
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: "flake8 on code"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
cache-dependency-path: poetry.lock
python-version: "3.11"
- name: Install dependencies
env:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
run: |
python -m pip --quiet install poetry
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
poetry install
- name: Run flake8
shell: bash
run: |
poetry run flake8 fakeredis/
- name: Test import
run: |
poetry build
pip install dist/fakeredis-*.tar.gz
python -c "import fakeredis"
test:
name: >
py:${{ matrix.python-version }},${{ matrix.redis-image }},
redis-py:${{ matrix.redis-py }},cov:${{ matrix.coverage }},
lupa:${{ matrix.lupa }}, json:${{matrix.json}}
needs:
- "lint"
runs-on: ubuntu-latest
strategy:
max-parallel: 8
fail-fast: false
matrix:
redis-image: [ "redis:6.2.13", "redis:7.0.12", "redis:7.2.0" ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
redis-py: [ "4.3.6", "4.5.5", "4.6.0", "5.0.0" ]
include:
- python-version: "3.11"
redis-image: "redis:6.2.12"
redis-py: "5.0.0"
lupa: true
hypothesis: true
- python-version: "3.11"
redis-image: "redis/redis-stack-server:7.2.0-v0"
redis-py: "5.0.0"
lupa: true
json: true
coverage: true
hypothesis: true
permissions:
pull-requests: write
services:
redis:
image: ${{ matrix.redis-image }}
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
outputs:
version: ${{ steps.getVersion.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
cache-dependency-path: poetry.lock
python-version: ${{ matrix.python-version }}
- name: Install dependencies
env:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
run: |
python -m pip --quiet install poetry
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
poetry install
poetry run pip install redis==${{ matrix.redis-py }}
- name: Install lupa
if: ${{ matrix.lupa }}
run: |
poetry run pip install fakeredis[lua]
- name: Install json
if: ${{ matrix.json }}
run: |
poetry run pip install fakeredis[json]
- name: Get version
id: getVersion
shell: bash
run: |
VERSION=$(poetry version -s --no-ansi -n)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Test without coverage
if: ${{ !matrix.coverage }}
run: |
poetry run pytest -v -m "not slow"
- name: Test with coverage
if: ${{ matrix.coverage }}
uses: ./.github/actions/test-coverage
with:
github-secret: ${{ secrets.GITHUB_TOKEN }}
gist-secret: ${{ secrets.GIST_SECRET }}
# Prepare a draft release for GitHub Releases page for the manual verification
# If accepted and published, release workflow would be triggered
update_release_draft:
name: "Create or Update release draft"
permissions:
# write permission is required to create a GitHub release
contents: write
# write permission is required for auto-labeler
# otherwise, read permission is required at least
pull-requests: write
needs:
- "test"
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}