added cluster tests to CI #176
Workflow file for this run
This file contains hidden or 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: CI | |
| on: [push, pull_request] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| # - '3.13' | |
| django-version: | |
| - '4.2' | |
| - '5.0' | |
| - '5.1' | |
| valkey-version: | |
| - 'latest' | |
| - '7.2' | |
| services: | |
| valkey: | |
| image: valkey/valkey:${{ matrix.valkey-version }} | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "valkey-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| --volume /tmp:/tmp | |
| env: | |
| VALKEY_EXTRA_FLAGS: '--save "" --unixsocket /tmp/valkey.sock --unixsocketperm 777' | |
| sentinel: | |
| image: bitnami/valkey-sentinel:${{ matrix.valkey-version }} | |
| ports: | |
| - 26379:26379 | |
| options: >- | |
| --health-cmd "valkey-cli -p 26379 ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| --volume /tmp:/tmp | |
| env: | |
| VALKEY_SENTINEL_QUORUM: "1" | |
| VALKEY_SENTINEL_AOF_ENABLED: "no" | |
| 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: ./.venv | |
| # key: venv-${{ hashFiles('poetry.lock') }} | |
| - name: Install poetry | |
| if: steps.cached-poetry.outputs.cache-hit != 'true' | |
| uses: abatilo/actions-poetry@v3 | |
| - name: install dependencies | |
| run: poetry install --no-interaction --no-root --all-extras --with dev | |
| - name: config poetry | |
| run: | | |
| poetry config virtualenvs.create true --local | |
| poetry config virtualenvs.in-project true --local | |
| - name: Install project | |
| run: | | |
| poetry add django==${{ matrix.django-version }} | |
| poetry install --no-interaction --all-extras | |
| - name: tests | |
| run: | | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_herd | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_json | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_lz4 | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_msgpack | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_sentinel | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_sentinel_opts | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_sharding | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_usock | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_zlib | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_zstd | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_gzip | |
| poetry run pytest tests/*.py --ds=tests.settings.sqlite_bz2 | |
| poetry run pytest tests/tests_async/*.py --ds=tests.settings.sqlite_async | |
| poetry run pytest tests/tests_async/*.py --ds=tests.settings.sqlite_async_herd | |
| env: | |
| DJANGO: ${{ matrix.django-version }} | |
| VALKEY: ${{ matrix.valkey-version }} | |
| populate-cache: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| name: Update docker cache | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache docker images | |
| id: custom-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./custom-cache/ | |
| key: custom-cache | |
| - if: ${{ steps.custom-cache.outputs.cache-hit != 'true' || github.event_name == 'schedule' }} | |
| name: Update Cache | |
| run: | | |
| mkdir -p ./custom-cache/ | |
| docker compose --profile all build | |
| docker pull valkey/valkey:latest | |
| docker save django-valkey-cluster:latest -o ./custom-cache/all.tar | |
| run-tests: | |
| runs-on: ubuntu-latest | |
| needs: [populate-cache] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| # - '3.13' | |
| django-version: | |
| - '4.2' | |
| - '5.0' | |
| - '5.1' | |
| env: | |
| ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
| 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 docker image | |
| id: custom-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./custom-cache/ | |
| fail-on-cache-miss: true | |
| key: custom-cache | |
| - name: use Cache | |
| run: docker image load -i ./custom-cache/all.tar | |
| # - name: Cache | |
| # id: cached-poetry | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: ./.venv | |
| # key: venv-${{ hashFiles('poetry.lock') }} | |
| - name: Install poetry | |
| if: steps.cached-poetry.outputs.cache-hit != 'true' | |
| uses: abatilo/actions-poetry@v3 | |
| - name: install dependencies | |
| run: | | |
| poetry install --no-interaction --no-root --all-extras --with dev | |
| - name: config poetry | |
| run: | | |
| poetry config virtualenvs.create true --local | |
| poetry config virtualenvs.in-project true --local | |
| - name: Install project | |
| run: | | |
| poetry add django==${{ matrix.django-version }} | |
| poetry install --no-interaction --all-extras | |
| - name: tests | |
| run: | | |
| poetry run invoke devenv | |
| ./util/wait-for-it.sh localhost:16379 | |
| poetry run pytest tests/tests_cluster/*.py --ds=tests.settings.sqlite_cluster | |
| env: | |
| DJANGO: ${{ matrix.django-version }} | |
| VALKEY: ${{ matrix.valkey-version }} |