diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml new file mode 100644 index 0000000..1ad9cf2 --- /dev/null +++ b/.github/workflows/black.yaml @@ -0,0 +1,13 @@ +name: black + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: psf/black@stable + with: + options: "--check --verbose" + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..03df20d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,109 @@ +name: CI + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + python-version: + - '3.10' + - '3.11' + - '3.12' + django-version: + - '4.2' + - '5.0' + - '5.1' + valkey-version: + - 'latest' + + # Only test pre-release dependencies for the latest Python. + include: + # Django 4.2 and python 3.8 with latest redis + - django-version: '4.2' + valkey-version: 'latest' + python-version: '3.8' + + # Django 4.2 and python 3.9 with latest redis + - django-version: '4.2' + valkey-version: 'latest' + python-version: '3.9' + + # latest Django with pre-release redis + - django-version: '5.0' + valkey-version: 'master' + python-version: '3.11' + + # latest redis with pre-release Django + - django-version: 'main' + valkey-version: 'latest' + python-version: '3.12' + + # pre-release Django and redis + - django-version: 'main' + valkey-version: 'master' + python-version: '3.11' + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Cache + id: cached-poetry + uses: actions/cache@v4 + with: + path: ~/.local + key: poetry-0 + + - name: Install poetry + if: steps.cached-poetry.outputs.cache-hit != 'true' + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + virtualenvs-path: .venv + installer-parallel: true + + - name: install dependencies + run: poetry install --no-interaction --no-root --all-extras --with dev + - name: activate env + run: poetry shell + + - name: Install project + run: poetry install --no-interaction + + - name: tests + run: | + VALKEY_PRIMARY=$(tests/start_valkey.sh) + VALKEY_SENTINEL=$(tests/start_valkey.sh --sentinel) + CONTAINERS="$VALKEY_PRIMARY $VALKEY_SENTINEL" + trap "docker stop $CONTAINERS && docker rm $CONTAINERS" EXIT + tests/wait_for_valkey.sh $VALKEY_PRIMARY 6379 + tests/wait_for_valkey.sh $VALKEY_SENTINEL 26379 + + tox + pytest --ds=tests.settings.sqlite + pytest --ds=tests.settings.sqlite_herd + pytest --ds=tests.settings.sqlite_json + pytest --ds=tests.settings.sqlite_lz4 + pytest --ds=tests.settings.sqlite_msgpack + pytest --ds=tests.settings.sqlite_sentinel + pytest --ds=tests.settings.sqlite_sentinel_opts + pytest --ds=tests.settings.sqlite_sharding + pytest --ds=tests.settings.sqlite_usock + pytest --ds=tests.settings.sqlite_zlib + pytest --ds=tests.settings.sqlite_zstd + pytest --ds=tests.settings.sqlite_gzip + + env: + DJANGO: ${{ matrix.django-version }} + VALKEY: ${{ matrix.valkey-version }} + + diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..03a0d83 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,25 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + push: + branches: + - main + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: build and publish + uses: JRubics/poetry-publish@v2.0 + with: + pypi_token: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/ruff.yaml b/.github/workflows/ruff.yaml new file mode 100644 index 0000000..f7ae6d8 --- /dev/null +++ b/.github/workflows/ruff.yaml @@ -0,0 +1,8 @@ +name: ruff +on: [push, pull_request] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: chartboost/ruff-action@v1 diff --git a/pyproject.toml b/pyproject.toml index f2860b1..7ace110 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-valkey" -version = "0.0.1" +version = "0.0.8" license = "BSD-3-Caluse" description = "a valkey backend for django, forked from django-redis" authors = ["amirreza "]