Skip to content

Commit

Permalink
setup Redis for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tonioo committed Dec 22, 2023
1 parent f9dd6e3 commit 8ab70c9
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ jobs:
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis
ports:
- 6379/tcp
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
Expand All @@ -53,7 +62,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update -y \
&& sudo apt-get update -y && sudo apt-get install -y librrd-dev rrdtool
&& sudo apt-get update -y && sudo apt-get install -y librrd-dev rrdtool redis-server
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt
Expand All @@ -63,6 +72,11 @@ jobs:
python setup.py develop
cd ../modoboa-webmail
python setup.py develop
echo "Testing redis connection"
redis-cli -h $REDIS_HOST -p $REDIS_PORT ping
env:
REDIS_HOST: localhost
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
- name: Install postgres requirements
if: ${{ matrix.database == 'postgres' }}
run: |
Expand All @@ -84,6 +98,8 @@ jobs:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} # get randomly assigned published port
MYSQL_USER: root
REDIS_HOST: localhost
REDIS_PORT: ${{ job.services.redis.ports[6379] }}

- name: Test with pytest and coverage
if: ${{ matrix.python-version == '3.10' && matrix.database == 'postgres' }}
Expand All @@ -99,6 +115,8 @@ jobs:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} # get randomly assigned published port
MYSQL_USER: root
REDIS_HOST: localhost
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
- name: Upload coverage result
if: ${{ matrix.python-version == '3.10' && matrix.database == 'postgres' }}
uses: actions/upload-artifact@v3
Expand Down

0 comments on commit 8ab70c9

Please sign in to comment.