name: django-test

on: [push]

jobs:
  run_tests:
    name: Run Django Tests
    runs-on: ubuntu-latest
    services:
      db:
        image: postgres:alpine
        env:
          POSTGRES_PASSWORD: postgres
          POSTGRES_USER: postgres
          POSTGRES_DB: unicodex
        ports:
        - 5432:5432
        options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd
          pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
    steps:
    - name: Checkout
      uses: actions/checkout@v1

    - name: Set up Python
      uses: actions/setup-python@v1
      with:
        python-version: 3.x

    - name: Create local settings
      run: |
        # Ensure database port is dynamic
        echo "DATABASE_URL='postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/unicodex'" > .env
        # Enter some useful defaults for other environment variables
        echo -en "SECRET_KEY=asdfasdfasdf\nSUPERUSER=admin\nSUPERPASS=admin\nDBEUG=True" >> .env
    - name: Install dependencies
      run: pip install -r requirements.txt

    - name: Run tests
      run: python manage.py test --exclude external

name: django-test

on:
 push:
   branches: 
    - latest
   
 pull_request:
    
 schedule:
   - cron: "0 16 * * 1"  # Weekly on Tuesdays

jobs:
  run_tests:
    name: Run Django Tests
    runs-on: ubuntu-latest
    services:
      db:
        image: postgres:alpine
        env:
          POSTGRES_PASSWORD: postgres
          POSTGRES_USER: postgres
          POSTGRES_DB: unicodex
        ports:
        - 5432:5432
        options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd
          pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
    steps:
    - name: Checkout
      uses: actions/checkout@v1

    - name: Set up Python
      uses: actions/setup-python@v1
      with:
        python-version: 3.x

    - name: Create local settings
      run: |
        # Ensure database port is dynamic
        echo "DATABASE_URL='postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/unicodex'" > .env
        # Enter some useful defaults for other environment variables
        echo -en "SECRET_KEY=asdfasdfasdf\nSUPERUSER=admin\nSUPERPASS=admin\nDBEUG=True" >> .env
    - name: Install dependencies
      run: pip install -r requirements.txt

    - name: Run tests
      run: python manage.py test --exclude external

Update test to run periodically
Update test to run periodically