name:  Django CI

on: 
  push: 
    branches:  [ "main" ]
  pull_request: 
    branches:  [ "main" ]
env: 
  HOSTING_URL: "http://localhost:8000/"
  DEBUG: True
  EMAIL: karthik.murakonda14@gmail.com
  EMAIL_PASSWORD: 1234567890
  EMAIL_VERIFICATION_SECRET_KEY: "b'<\xa3\xaf&d6\xa9sf\x19$\x96\xb7\x90\x8b\x88\x84\x0e\x191\xde,M\x90\x17(\xf7\nG\x13\x8d$\x9f&\xb0\xcd\xa4\xaf\xa9\x1b\x15\x02B\x8a\xaf\xff\x0c\x1e\xd5\xb3\x06\xb8\xa6\x9bQ\xa0TR\xe8\x98\x9ae\xe0n}\xcc/[\xdaFz\x18\xfeX\xaf\xbd\xd0\x88\xeal\xe3\xd2\xe3\xb8\x8c\x199{\xf3<\xb0\xc5\xd0\xe7*Rv\xda\xbb \x1d\x85~\xff%>\x1e\xb8\xa7\xbf\xbc\xb2\x06\x86X\xc3\x9f\x13<\x9fd\xea\xb5\x01\xa4\x7f\xa0\x1b\x8bO\x01h\xe8\xfd\x1f\xfe\xba\xbeg\\\xc2\xcb\xc3\xd1~\xff\xd5/9d\xa8\xa7x{\x16\xdb\\\xbb\x08\rI\xcd\x9e7\x8c~\x0f\x1d\x81rXZD\xf0\xf7\x87K\x8f\xfb,\xf4\xf0\xa5\x9e\xde^\xca\xae\x80|9b\x9b\xaaE\xba\xfb\xdf\x80\xb1\x99\x83e[\xf8\xce&Rq\x99\xdb}\xeeO\xd5\x18\x8d\x0bv\xe7\xab\xf9\xb9{\xb5u\xce\xcf\x90\xa6HE\xc5\x92p\x00\x158\xdf'"
  DB_NAME: cdc
  DB_USER: postgres
  DB_PASSWORD: postgres
  DB_HOST: localhost
  DB_PORT: 5432
  RECAPTCHA_SECRET_KEY: 6LfpadYhAAAAAJUIJQ_JJqkqq3arvalwkVCgW3nG
  GOOGLE_OAUTH_CLIENT_ID: 628308091838-nvfn455vabbq7j0odd797sls8itpplmr.apps.googleusercontent.com
  SECRET_KEY: 9%2e!&f6(ib^690y48z)&w6fczhwukzzp@3y*^*7u+7%4s-mie
  GOOGLE_OAUTH_CLIENT_SECRET: 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
  REFRESH_TOKEN: 1//0gCf5fxAgSqNcCgYIARAAGBASNwF-L9IrIWxWwqmboeJkEzVn0sqxbaeyWXODE5s24V7pSdiAzFM2cxOUC9XT_xp7t_60o3JMfOg
  EMAIL_ID: 200010030@iitdh.ac.in
  ROLL_NO: 200010030

jobs: 
  build: 

    runs-on:  ubuntu-latest

    services:
      postgres:
        image: postgres
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: cdc
        ports:
          - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

    strategy: 
      max-parallel:  4
      matrix: 
        python-version:  [3.9]

    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 requirements.txt
    - name:  Run Tests
      run:  |
        cd CDC_Backend
        python manage.py collectstatic
        python manage.py makemigrations
        python manage.py makemigrations APIs
        python manage.py test
