Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
whusterj committed Sep 8, 2023
0 parents commit e1df2e4
Show file tree
Hide file tree
Showing 364 changed files with 1,654,595 additions and 0 deletions.
149 changes: 149 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
#
# Application Environment Configuration
#
# IMPORTANT: If you intend to add or modify application environment variables,
# then you MUST consider the following.
#
# This example environment configuration should always work as-is. Any required
# variables should have a suitable default set here or fall back to a suitable
# default when interpreted in settings.py.

#
# Secret Key
#
# (Required) Django uses the secret key to protect certain application
# secrets. Secret keys should not be used across environments, especially
# not in production. An example secret key is provided here for convenience
# in development.
#
SECRET_KEY='^+g)%kvmlbk@@3l3q=%319_d7o#&$7p-ej0lm!c8_%3jbfcsra'

#
# Environment Name
#
# (Required) The environment that the app is currently running in.
# The value can be one of: 'development', 'staging', 'production'.
#
ENVIRONMENT='development'

#
# Staff Configuration
#
# (Optional) Set the email of the {project_name_capitalcase} staff user who should receive emails.
#
STAFF_EMAIL='ThinkNimble <hello@thinknimble.com>'

#
# Host Name Configuration
#
# (Required) The following setting must have a value
#
# ALLOWED_HOSTS A comma-separated list of valid hosts. Clients must make
# requests
# CURRENT_DOMAIN This will be the "primary" domain for the purpose of user-facing
# links, for example permalinks in emails or the user interface.
# If setting a custom value, this domain should also be included
# in the ALLOWED_HOSTS list.
#
# (Optional)
#
# CURRENT_PORT The port linked to the 'primary' domain for the purpose of user-facing
# links.
#
ALLOWED_HOSTS='server,localhost,127.0.0.1'
CURRENT_DOMAIN='localhost'
CURRENT_PORT='8080'

#
# Enable/Disable the Django Debug Feature
#
# (Required) Enables/disables the Django debug feature, which shows reports detailed
# exception information and stack traces to the client's browser, which is useful for
# debugging during development and testing. Note: DEBUG should NEVER be enabled in
# production environments, since it could leak user information or other application
# secrets.
#
DEBUG=True

#
# Database Configuration
#
# (Required in development, optional in staging and production) The application uses
# PostgreSQL as a database back end. The following settings are required to enable
# the application to access the database in development.
#
# DB_NAME The name of the PostgreSQL database.
# DB_USER The name of the user with permission to access the PostgreSQL database.
# DB_PASS The password of the user with permission to access the PostgreSQL database.ce
# environments, the database URL and credentials are automatically read from the
# Heroku environment, and so these settings are ignored.
#
DB_NAME='vector_demonstration_db'
DB_USER='vector_demonstration'
DB_PASS='+06dcfd+$d57@77p-!7(*$5w6nsab%v(+!1&dx=^gbr0@v1+&#'
DB_HOST='127.0.0.1'

# TEST DB SETTINGS THESE MUST MATCH GH ACTIONS
TEST_DB_NAME='vector_demonstration_test_db'
TEST_DB_USER='testuser'
TEST_DB_PASS='testpass'

#
# Rollbar Configuration
#
# (Optional) Exceptions can be sent to Rollbar, which helps track and organize
# error reports across environments. The following settings are optional:
#
# ROLLBAR_ACCESS_TOKEN Access token for the Rollbar API. Required.
#
ROLLBAR_ACCESS_TOKEN=''

#
# Enable/Disable AWS Services
#
# (Optional) Enable the AWS services this app should use
#
# USE_AWS_STORAGE If 'True', AWS S3 storage will be used as the application's storage
# backend. Valid IAM User credentials will also be required (see below).
#
USE_AWS_STORAGE='False'

#
# AWS S3 Storage Credentials
#
# (Optional) The following settings only required if USE_AWS_STORAGE is set to 'True'.
#
# AWS_ACCESS_KEY_ID IAM User's Access Key from the AWS dashboard.
# AWS_SECRET_ACCESS_KEY IAM User's Secret Access Key from the AWS dashboard.
# AWS_STORAGE_BUCKET_NAME The name of the S3 bucket to use for storage.
# AWS_LOCATION Folder location inside of the S3 storage bucket.
# AWS_S3_REGION_NAME Region name (ex: 'us-east-2') required in order to receive correct
# query authorization mechanism parameters for private URLs.
#
AWS_ACCESS_KEY_ID=''
AWS_SECRET_ACCESS_KEY=''
AWS_STORAGE_BUCKET_NAME=''
AWS_LOCATION=''
AWS_S3_REGION_NAME=''

#
# Redis (optional)
#
REDIS_URL='redis://127.0.0.1:6379/1'

#
# Any Mail
#
ENABLE_EMAILS='False'
SMTP_USER=''
SMTP_PASSWORD=''
SMTP_HOST='smtp.mailgun.org'
SMTP_PORT='587'
SMTP_VALID_TESTING_DOMAINS='thinknimble.com'
DEFAULT_FROM_EMAIL='Vector Demonstration <noreply@vector_demonstration.com>'


# Testing (NOTE: Heroku and Github Actions will need to have matching values for some of these)
DJANGO_SUPERUSER_PASSWORD='^+g)%kvmlbk@@3l3q=%319_d7o#&$7p-ej0lm!c8_%3jbfcsra'
CYPRESS_TEST_USER_PASS='^+g)%kvmlbk@@3l3q=%319_d7o#&$7p-ej0lm!c8_%3jbfcsra'
CYPRESS_baseUrl='http://localhost:8080'
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
exclude = .git,*migrations*
# Match the line-length we configured for black in pyproject.toml
max-line-length = 140
extend-ignore =
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## What this does

Add a description of what feature/page this PR intends to add or change.

- [ticket title](URL to story/issue/ticket goes here)

## Checklist
- [ ] Add ticket number to PR title (if applicable)
- [ ] Todo 2
- [ ] Todo 3


## Deploy Notes

Add any notes for changes needed when deployed. I.e. API keys, environment variables, database changes, etc.

## How to test

Add user steps to achieve desired functionality for this feature.

## Django Admin
| user | password | has admin | notes |
| --- | --- | --- | --- |
| `admin@thinknimble.com` | ^+g)%kvmlbk@@3l3q=%319_d7o#&$7p-ej0lm!c8_%3jbfcsra | :white_check_mark: | |
| `cypress@example.com` | ^+g)%kvmlbk@@3l3q=%319_d7o#&$7p-ej0lm!c8_%3jbfcsra | :x: | Only use for automated E2E testing |
40 changes: 40 additions & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Cypress Tests
on: [deployment_status]

jobs:
Chrome:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/checkout@v3
- name: Run against ${{ github.event.deployment_status.environment_url }}
uses: cypress-io/github-action@v4
with:
working-directory: client
browser: chrome
env:
NPM_CONFIG_PRODUCTION: false
CYPRESS_TEST_USER_EMAIL: "cypress@example.com"
CYPRESS_TEST_USER_PASS: ${{ secrets.CYPRESS_TEST_USER_PASS }}
CYPRESS_baseUrl: ${{ github.event.deployment_status.environment_url }}
Firefox:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
container:
image: cypress/browsers:node16.14.2-slim-chrome103-ff102 # https://github.com/cypress-io/cypress-docker-images/tree/master/browsers
options: --user 1001
steps:
- uses: actions/checkout@v3
- name: Run against ${{ github.event.deployment_status.environment_url }}
uses: cypress-io/github-action@v4
with:
working-directory: client
browser: firefox
env:
NPM_CONFIG_PRODUCTION: false
CYPRESS_TEST_USER_EMAIL: "cypress@example.com"
CYPRESS_TEST_USER_PASS: ${{ secrets.CYPRESS_TEST_USER_PASS }}
CYPRESS_baseUrl: ${{ github.event.deployment_status.environment_url }}
42 changes: 42 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Linter
on: [push]
jobs:
Black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: pipx install pipenv
- uses: actions/setup-python@v2
with:
python-version: '3.10'
cache: 'pipenv'
- run: pipenv install --dev --deploy
- run: pipenv run black --check server
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: pipx install pipenv
- uses: actions/setup-python@v2
with:
python-version: '3.10'
cache: 'pipenv'
- run: pipenv install --dev --deploy
- run: pipenv run flake8 server
ESLint_and_Prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
env:
NPM_CONFIG_PRODUCTION: false
working-directory: ./client
run: |
npm install
- name: Run ESLint
working-directory: ./client
run: npx eslint --ext .js,.vue src

35 changes: 35 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Unit Tests
on: [push]
jobs:
pytest:
runs-on: ubuntu-latest
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: vector_demonstration_test_db
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- run: pipx install pipenv
- uses: actions/setup-python@v2
with:
python-version: '3.10'
cache: 'pipenv'
- run: pipenv install --dev --deploy
- name: 'Create env file'
run: |
touch .env
cat .env.example > .env
cat .env
- run: mkdir -p client/dist/static
- run: pipenv run python server/manage.py collectstatic
- run: pipenv run pytest --mccabe --cov=vector_demonstration -vv server/vector_demonstration
- run: pipenv run coverage report --fail-under=20
Loading

0 comments on commit e1df2e4

Please sign in to comment.