ACL commands #1475
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Unit tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: "Code linting (flake8/black)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
cache-dependency-path: poetry.lock | |
python-version: "3.12" | |
- 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: Run black | |
shell: bash | |
run: | | |
poetry run black --check --verbose fakeredis test | |
- name: Test import | |
run: | | |
poetry build | |
pip install dist/fakeredis-*.tar.gz | |
python -c "import fakeredis" | |
test: | |
name: > | |
redis tests | |
py:${{ matrix.python-version }},${{ matrix.redis-image }}, | |
redis-py:${{ matrix.redis-py }},cov:${{ matrix.coverage }}, | |
extra:${{matrix.extra}} | |
needs: | |
- "lint" | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 8 | |
fail-fast: false | |
matrix: | |
redis-image: [ "redis:6.2.14", "redis:7.0.15", "redis:7.4.0" ] | |
python-version: [ "3.9", "3.11", "3.12", "3.13" ] | |
redis-py: [ "4.3.6", "4.6.0", "5.0.8", "5.2.0" ] | |
include: | |
- python-version: "3.12" | |
redis-image: "valkey/valkey:8.0" | |
redis-py: "5.2.0" | |
extra: "lua" | |
hypothesis: true | |
- python-version: "3.12" | |
redis-image: "redis/redis-stack-server:6.2.6-v15" | |
redis-py: "5.2.0" | |
extra: "json, bf, lua, cf" | |
hypothesis: true | |
- python-version: "3.12" | |
redis-image: "redis/redis-stack-server:7.4.0-v0" | |
redis-py: "5.2.0" | |
extra: "json, bf, lua, cf" | |
coverage: true | |
hypothesis: true | |
permissions: | |
pull-requests: write | |
services: | |
redis: | |
image: ${{ matrix.redis-image }} | |
ports: | |
- 6390: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@v5 | |
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 | |
# if python version is below 3.10 and redis-py is 5.0.9 - change it to 5.0.8 | |
if [[ ${{ matrix.python-version }} != "3.10" && ${{ matrix.redis-py }} == "5.0.9" ]]; then | |
poetry run pip install redis==5.0.8 | |
fi | |
poetry run pip install redis==${{ matrix.redis-py }} | |
- name: Install json | |
if: ${{ matrix.extra }} | |
run: | | |
poetry run pip install "fakeredis[${{ matrix.extra }}]" | |
- 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@v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |