Updated github workflows

This commit is contained in:
Ceferino Patino 2022-09-03 11:05:33 -05:00
commit 6cd4bb0075
11 changed files with 238 additions and 150 deletions

View file

@ -2,8 +2,7 @@ name: Create release draft
on:
push:
branches: [development]
workflow_dispatch:
branches: [dev]
jobs:
draft:

View file

@ -2,7 +2,7 @@ name: Test build
on:
push:
branches: [development, main]
branches: [main, dev]
pull_request:
workflow_dispatch:

View file

@ -1,2 +1,3 @@
from . import dev
from . import prod
from . import test

View file

@ -36,6 +36,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'smart_selects',
'formtools',
'housewars.apps.HousewarsConfig'
@ -142,3 +143,5 @@ MESSAGE_TAGS = {constants.DEBUG: 'debug',
constants.SUCCESS: 'success',
constants.WARNING: 'warning',
constants.ERROR: 'danger', }
USE_DJANGO_JQUERY = True

View file

@ -0,0 +1,141 @@
from pathlib import Path
import os
from django.contrib.messages import constants
from dotenv import dotenv_values
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
DOTENV_FILE = BASE_DIR / '.env'
CONFIG = dotenv_values(DOTENV_FILE)
SECRET_KEY = CONFIG.get('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
ALLOWED_HOSTS = [
'localhost',
'127.0.0.1',
]
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'smart_selects',
'formtools',
'housewars.apps.HousewarsConfig'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'CollegiateHouseWars.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'CollegiateHouseWars.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_URL = 'static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
STATICFILES_DIRS = [
BASE_DIR / "static"
]
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
MESSAGE_TAGS = {constants.DEBUG: 'debug',
constants.INFO: 'info',
constants.SUCCESS: 'success',
constants.WARNING: 'warning',
constants.ERROR: 'danger', }
USE_DJANGO_JQUERY = True

View file

@ -30,8 +30,6 @@ services:
- housewars
environment:
MYSQL_ROOT_PASSWORD: "${DATABASE_PASSWORD}"
MYSQL_USER: "${DATABASE_USERNAME}"
MYSQL_PASSWORD: "${DATABASE_PASSWORD}"
MYSQL_DATABASE: dev
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]

View file

@ -1,7 +1,8 @@
# Generated by Django 4.0.4 on 2022-09-03 04:48
# Generated by Django 4.0.4 on 2022-09-03 16:15
from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields
class Migration(migrations.Migration):
@ -63,8 +64,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(blank=True, max_length=15)),
('activity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='housewars.activity')),
('award', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='housewars.award')),
('activity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='Activity', to='housewars.activity')),
('award', smart_selects.db_fields.ChainedForeignKey(chained_field='activity', chained_model_field='activity', on_delete=django.db.models.deletion.CASCADE, to='housewars.award')),
('house', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='housewars.house')),
],
options={

View file

@ -1,30 +0,0 @@
# Generated by Django 4.0.4 on 2022-09-03 05:12
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.expressions
class Migration(migrations.Migration):
dependencies = [
('housewars', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='award',
name='activity',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='awards', to='housewars.activity'),
),
migrations.AlterField(
model_name='pointsentry',
name='activity',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='Activity', to='housewars.activity'),
),
migrations.AlterField(
model_name='pointsentry',
name='award',
field=models.ForeignKey(limit_choices_to=models.Q(('activity__award', django.db.models.expressions.F('activity'))), on_delete=django.db.models.deletion.CASCADE, to='housewars.award'),
),
]

View file

@ -1,25 +0,0 @@
# Generated by Django 4.0.4 on 2022-09-03 05:46
from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields
class Migration(migrations.Migration):
dependencies = [
('housewars', '0002_alter_award_activity_alter_pointsentry_activity_and_more'),
]
operations = [
migrations.AlterField(
model_name='award',
name='activity',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='housewars.activity'),
),
migrations.AlterField(
model_name='pointsentry',
name='award',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='activity', chained_model_field='activity__name', null=True, on_delete=django.db.models.deletion.CASCADE, to='housewars.award'),
),
]