49 lines
1.2 KiB
YAML
49 lines
1.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
test:
|
|
name: Django Tests
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: apps/api
|
|
services:
|
|
postgres:
|
|
image: postgres:15
|
|
env:
|
|
POSTGRES_DB: test_usermanager
|
|
POSTGRES_USER: test
|
|
POSTGRES_PASSWORD: test
|
|
ports: ["5432:5432"]
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
|
|
- name: Run Django tests
|
|
env:
|
|
DJANGO_SETTINGS_MODULE: config.settings
|
|
DATABASE_URL: postgres://test:test@localhost:5432/test_usermanager
|
|
SECRET_KEY: test-secret-key-for-testing-only
|
|
JWT_PUBLIC_KEY: ${{ secrets.JWT_PUBLIC_KEY }}
|
|
run: |
|
|
python -m pytest apps/authentication/tests.py -v |