-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from mantiumai/test-and-linter-actions
Test and linter GiHub actions
- Loading branch information
Showing
68 changed files
with
486 additions
and
369 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Django CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: ["3.10", "3.11"] | ||
|
||
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 | ||
pip install pylint | ||
pip install pylint-django | ||
pip install isort | ||
- name: Generate Fernet Key | ||
run: | | ||
cd chirps; | ||
python -c "from cryptography.fernet import Fernet; print(f'FERNET_KEY={Fernet.generate_key().decode()}')" > .env | ||
- name: Run Tests | ||
run: | | ||
cd chirps; python manage.py test | ||
- name: Run Linting | ||
run: | | ||
isort --check-only --diff . | ||
pylint --load-plugins pylint_django --django-settings-module="chirps.settings" $(find . -name "*.py" | xargs) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
[FORMAT] | ||
max-line-length=120 | ||
|
||
[MASTER] | ||
# Ignore Django migration files | ||
ignore-patterns=\d{4}_.*?.py | ||
|
||
[MESSAGES CONTROL] | ||
disable=duplicate-code,too-few-public-methods,imported-auth-user | ||
ignored-modules=pinecone |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
"""Define admin interface models for the account application.""" | ||
from django.contrib import admin | ||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin | ||
from django.contrib.auth.models import User | ||
|
||
# Register your models here. | ||
from .models import Profile | ||
|
||
|
||
class ProfileInline(admin.StackedInline): | ||
"""Inline admin descriptor for the Profile model.""" | ||
|
||
model = Profile | ||
can_delete = False | ||
verbose_name_plural = 'profile' | ||
|
||
|
||
class UserAdmin(BaseUserAdmin): | ||
"""Define a new User admin.""" | ||
inlines = [ProfileInline] | ||
|
||
|
||
# Re-register UserAdmin | ||
admin.site.unregister(User) | ||
admin.site.register(User, UserAdmin) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
"""Configures the account app.""""" | ||
from django.apps import AppConfig | ||
|
||
|
||
class AccountConfig(AppConfig): | ||
"""Configuration options for the account application.""" | ||
|
||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'account' |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,10 @@ | ||
from django.contrib import admin | ||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin | ||
"""Models for the account appliation.""" | ||
from django.contrib.auth.models import User | ||
from django.db import models | ||
|
||
|
||
class Profile(models.Model): | ||
"""Custom profile model for users.""" | ||
|
||
user = models.OneToOneField(User, on_delete=models.CASCADE) | ||
openai_key = models.CharField(max_length=100, blank=True) | ||
|
||
|
||
# Define an inline admin descriptor for Employee model | ||
# which acts a bit like a singleton | ||
class ProfileInline(admin.StackedInline): | ||
model = Profile | ||
can_delete = False | ||
verbose_name_plural = 'profile' | ||
|
||
|
||
# Define a new User admin | ||
class UserAdmin(BaseUserAdmin): | ||
inlines = [ProfileInline] | ||
|
||
|
||
# Re-register UserAdmin | ||
admin.site.unregister(User) | ||
admin.site.register(User, UserAdmin) |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
"""Define any admin interface models for the base application.""" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
"""Application configration for the base_app app.""" | ||
from django.apps import AppConfig | ||
|
||
|
||
class BaseAppConfig(AppConfig): | ||
"""Application configration for the base_app app.""" | ||
|
||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'base_app' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
"""Forms for the base application.""" | ||
from django import forms | ||
|
||
class InstallForm(forms.Form): | ||
|
||
class InstallForm(forms.Form): | ||
"""Form to render the new installation page.""" | ||
superuser_username = forms.CharField(label='Superuser Username', max_length=100) | ||
superuser_email = forms.EmailField(label='Superuser Email', max_length=100) | ||
superuser_password = forms.CharField(label='Superuser Password', max_length=100, widget=forms.PasswordInput) | ||
superuser_password_confirm = forms.CharField(label='Superuser Password (Confirm)', max_length=100, widget=forms.PasswordInput) | ||
|
||
superuser_password_confirm = forms.CharField( | ||
label='Superuser Password (Confirm)', | ||
max_length=100, | ||
widget=forms.PasswordInput | ||
) |
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
Oops, something went wrong.