Skip to content

build(docker-compose): add docker-compose and uwsgi and nginx for dep… #130

build(docker-compose): add docker-compose and uwsgi and nginx for dep…

build(docker-compose): add docker-compose and uwsgi and nginx for dep… #130

Workflow file for this run

name: Django unittest
on:
push:
branches: ["*"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 3
matrix:
python-version: [3.9, "3.10", 3.11]
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./backend/requirements.txt
- name: Run Tests
env:
DATABASE_URL: ${{vars.TEST_DATABASE_URL}}
SECRET_KEY: ${{vars.TEST_SECRET_KEY}}
DEPLOY_WEB_HOST: ${{vars.TEST_WEB_HOST}}
DEPLOY_WEB_PORT: ${{vars.TEST_WEB_PORT}}
DEBUG: ${{vars.TEST_DEBUG}}
MODE: ${{vars.MODE}}
EMAIL_PASSWORD: ${{vars.TEST_EMAIL_PASSWORD}}
CSRF_TRUSTED_ORIGINS: ${{vars.TEST_CSRF_TRUSTED_ORIGINS}}
DJANGO_SESSION_COOKIE_NAME: ci_session
DJANGO_CSRF_COOKIE_NAME: ci_csrt_token
run: |
cd backend
echo '${{secrets.GOOGLE_OAUTH_CLIENT_SECRET}}' > client_secret.json
pytest --reuse-db -v -s --cov --cov-report xml:coverage.xml
- name: Run codacy-coverage-reporter
if: matrix.python-version == '3.11'
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# or
# api-token: ${{ secrets.CODACY_API_TOKEN }}
coverage-reports: backend/coverage.xml
# or a comma-separated list for multiple reports
# coverage-reports: <PATH_TO_REPORT>, <PATH_TO_REPORT>