Merge pull request #65 from Zncl2222/backend/refactor/settings #55
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: 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}} | |
EMAIL_PASSWORD: ${{vars.TEST_EMAIL_PASSWORD}} | |
CSRF_TRUSTED_ORIGINS: ${{vars.TEST_CSRF_TRUSTED_ORIGINS}} | |
run: | | |
cd backend | |
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> |