Skip to content

Merge pull request #837 from openzim/various_fixes #47

Merge pull request #837 from openzim/various_fixes

Merge pull request #837 from openzim/various_fixes #47

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches:
- main
jobs:
unit-tests:
runs-on: ubuntu-22.04
env:
POSTGRES_URI: nodb
steps:
- name: Retrieve source code
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dispatcher/backend/requirements.txt
pip install pytest
- name: Test with pytest
run: |
cd dispatcher/backend/src
PYTHONPATH=$PWD pytest tests/unit
integration-tests:
runs-on: ubuntu-22.04
services:
postgresdb:
image: postgres:15.2-bullseye
env:
POSTGRES_DB: zimtest
POSTGRES_PASSWORD: zimpass
POSTGRES_PORT: 5432
POSTGRES_USER: zimfarm
ports:
- 5432:5432
env:
POSTGRES_URI: postgresql+psycopg://zimfarm:zimpass@localhost:5432/zimtest
steps:
- name: Retrieve source code
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dispatcher/backend/requirements.txt
pip install -U pytest pytest-cov
- name: prepare Postgresql DB
run: |
cd $GITHUB_WORKSPACE/dispatcher/backend/src
PYTHONPATH=$PWD alembic upgrade head
- name: run tests
run: |
cd $GITHUB_WORKSPACE/dispatcher/backend/src
PYTHONPATH=$PWD pytest tests/ --cov=./
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}