DEV Community

Darshit Jain
Darshit Jain

Posted on • Edited on

1

Django Tests

Alt Text

My Workflow

My workflow checks for any linting errors or any changes that breaks the code and doesn't pass the tests on every new pull request or push to the repository! This makes sure that nothing is added to the repository that breaks the workflow. This helps in maintaining the quality of the code base.

Submission Category:

Maintainer Must-Haves

Yaml File

name: Django Tests

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Set up Python 3.6
      uses: actions/setup-python@v1
      with:
        python-version: 3.6
    - name: Setup environment variables
      run: |
        cp .env.example .env
        export DJANGO_SETTINGS_MODULE=main.settings
    - name: Install dependencies
      run: |
        sudo apt-get install libpq-dev 
        pip3 install -r requirements.txt

    - name: Linting
      working-directory: ./src
      run: |
        flake8 .
    - name: Migrations
      working-directory: ./src
      run: |
        python3 manage.py makemigrations
        python3 manage.py migrate
    - name: Coverage
      working-directory: ./src
      run: |
        pip3 install coverage
        coverage run --source='.' manage.py test
        bash <(curl -s https://codecov.io/bash) || echo 'Codecov failed to upload'
Enter fullscreen mode Exit fullscreen mode

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

If this post resonated with you, feel free to hit ❤️ or leave a quick comment to share your thoughts!

Okay