Skip to content

Fix tests

Fix tests #276

Workflow file for this run

name: Run Tests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
name: Test OneSilaHeadless
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: fake
POSTGRES_PASSWORD: fake
POSTGRES_DB: fake
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: '3.11.2'
- name: Install requirements
run: pip install -r requirements.txt
- name: Run tests and collect coverage
env:
POSTGRES_HOST: localhost
POSTGRES_USER: fake
POSTGRES_PASSWORD: fake
POSTGRES_DB: fake
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
REDIS_HOST: localhost
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
run: cd OneSila && coverage run --source='.' manage.py test && coverage json
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}