Skip to content

Add Identity Verification System #177

Add Identity Verification System

Add Identity Verification System #177

Workflow file for this run

name: Backend CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Set up Chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Install Chrome WebDriver
uses: nanasess/setup-chromedriver@master
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('backend/requirements.txt', 'backend/test-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov pytest-asyncio pytest-timeout pytest-mock
pip install -r requirements.txt
pip install -r test-requirements.txt
pip install webdriver-manager
pip install alembic psycopg2-binary
- name: Run database migrations
working-directory: ./backend
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_db
run: |
alembic upgrade head
- name: Run tests
working-directory: ./backend
env:
PYTHONPATH: ${{ github.workspace }}/backend
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_db
REDIS_URL: redis://localhost:6379/0
JWT_SECRET: test_secret_key
CHROME_DRIVER_PATH: /usr/local/bin/chromedriver
run: |
mkdir -p test-results
pytest tests/ --junitxml=test-results/results.xml --import-mode=importlib -v
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: backend/test-results/results.xml