Skip to content

refactor(channel_models): Avoid instantiating a new Redis instance ea… #2879

refactor(channel_models): Avoid instantiating a new Redis instance ea…

refactor(channel_models): Avoid instantiating a new Redis instance ea… #2879

Workflow file for this run

name: Tests
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
env:
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: bots
DB_HOST: localhost
REDIS_HOST: redis://localhost
services:
postgres:
image: postgres
env:
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_DB: ${{ env.DB_NAME }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
id: cp311
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Get full Python version
id: full-python-version
run: echo "version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")" >> $GITHUB_OUTPUT
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-cache-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock')}}-v20210414
- name: Install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Activate venv
run: |
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV
echo "PYTHONPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
- name: Run tests
run: python manage.py test