Merge pull request #999 from openzim/scheduling_prio #274
This file contains 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: 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@v4 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
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@v4 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
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@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |