Update django.yml #689
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 CI | |
on: | |
push: | |
branches: [ "develop", "tests", "main", "frontend_linting" ] | |
pull_request: | |
branches: [ "develop", "tests", "main", "frontend_linting" ] | |
jobs: | |
build: | |
runs-on: self-hosted | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: github_actions_2 | |
ports: | |
- 5433:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install Dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Linting API | |
run: | | |
cd api | |
flake8 . | |
cd .. | |
- name: Install Dependencies Frontend | |
run: | | |
cd frontend/frontend | |
npm i | |
npm install -g eslint | |
cd ../.. | |
- name: Linting Frontend | |
run: | | |
cd frontend/frontend | |
eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 | |
cd ../.. | |
- name: Run Backend Tests | |
env: | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
TENANT_ID: ${{ secrets.TENANT_ID }} | |
AD_URL: ${{ secrets.AD_URL }} | |
SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
DB_NAME: ${{ secrets.DB_NAME }} | |
DB_USER: ${{ secrets.DB_USER }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
DB_HOST: ${{ secrets.DB_HOST }} | |
DB_PORT: ${{ secrets.DB_PORT }} | |
DB_ENGINE: ${{secrets.DB_ENGINE}} | |
run: | | |
python manage.py makemigrations api | |
python manage.py migrate api | |
python manage.py test | |
- name: Run Frontend Tests | |
run: | | |
cd frontend/frontend | |
npm run cypress-component | |
cd ../.. | |
- name: Run Frontend Linting | |
run: | | |
cd frontend/frontend | |
eslint . | |
cd ../.. |