Skip to content

Commit 51fee3e

Browse files
committed
Initial commit
0 parents  commit 51fee3e

File tree

912 files changed

+86119
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

912 files changed

+86119
-0
lines changed

Diff for: .babelrc.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
modules: false,
7+
},
8+
],
9+
'@babel/preset-react',
10+
],
11+
env: {
12+
test: {
13+
presets: ['@babel/preset-env', '@babel/preset-react'],
14+
},
15+
},
16+
};

Diff for: .devcontainer/devcontainer.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.163.1/containers/docker-existing-docker-compose
3+
{
4+
"name": "Existing Docker Compose (Extend)",
5+
"dockerComposeFile": ["../docker-compose.yml"],
6+
"service": "web",
7+
"workspaceFolder": "/app",
8+
"settings": {
9+
"terminal.integrated.shell.linux": "bash",
10+
"python.pythonPath": "/usr/local/bin/python"
11+
},
12+
"extensions": ["ms-python.python", "editorconfig.editorconfig"]
13+
}

Diff for: .dockerignore

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/tbx/static_compiled/
2+
/tbx/settings/local.py
3+
4+
/Dockerfile
5+
/docker/Dockerfile*
6+
7+
.git
8+
**/__pycache__
9+
*.pyc
10+
.DS_Store
11+
*.swp
12+
/venv/
13+
/static/
14+
/media/
15+
/tmp/
16+
/.vagrant/
17+
/Vagrantfile.local
18+
node_modules/
19+
coverage
20+
/npm-debug.log
21+
/.idea/
22+
/.devcontainer/
23+
24+
# Distribution / packaging
25+
.Python
26+
env/
27+
build/
28+
develop-eggs/
29+
dist/
30+
downloads/
31+
eggs/
32+
.eggs/
33+
lib/
34+
lib64/
35+
parts/
36+
sdist/
37+
var/
38+
wheels/
39+
*.egg-info/
40+
.installed.cfg
41+
*.egg

Diff for: .editorconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false
12+
13+
[*.{yaml,yml,json,md}]
14+
indent_size = 2

Diff for: .env.example

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Uncomment this to disable running the front-end tooling in docker.
2+
# FRONTEND=local

Diff for: .eslintignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
coverage
3+
static_compiled
4+
static
5+
venv
6+
cloudflare/workers.js

Diff for: .eslintrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
// See https://github.com/torchbox/eslint-config-torchbox for rules.
3+
extends: 'torchbox',
4+
parser: '@babel/eslint-parser',
5+
};

Diff for: .flake8

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
ignore = E501,F405,W503
3+
exclude = */migrations/*,node_modules/,tbx/settings/local.py

Diff for: .git-blame-ignore-revs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# git-blame ignored revisions
2+
# To configure, run
3+
# git config blame.ignoreRevsFile .git-blame-ignore-revs
4+
# Requires Git > 2.23
5+
# See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
6+
7+
# Fix templates formatting with djhtml
8+
# pre-commit run djhtml --color=always --all-files
9+
b867caaabb109ca807559c73086f03fa2812fa31

Diff for: .github/pull_request_template.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[Link to Ticket]()
2+
3+
### Description of Changes Made
4+
5+
### How to Test
6+
7+
### Screenshots
8+
9+
<details>
10+
<summary>Expand to see more</summary>
11+
12+
</details>
13+
14+
### MR Checklist
15+
16+
- [ ] Add a description of your pull request and instructions for the reviewer to verify your work.
17+
- [ ] If your pull request is for a specific ticket, link to it in the description.
18+
- [ ] Stay on point and keep it small so the merge request can be easily reviewed.
19+
- [ ] Consider adding unit tests, especially for bug fixes. If you don't, tell us why.
20+
- [ ] Tests and linting passes.
21+
- [ ] Consider updating documentation. If you don't, tell us why.
22+
- [ ] If relevant, list the environments / browsers in which you tested your changes.

Diff for: .github/workflows/flightpath.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Copy prod to staging
2+
# The following secrets are required on GitHub:
3+
# - FLIGHTPATH_URL (URL for the flightpath excluding trailing slash)
4+
# - HEROKU_APP_NAME_PRODUCTION (source heroku app name)
5+
# - HEROKU_APP_NAME_STAGING (destination heroku app name)
6+
# - FLIGHTPATH_AUTH_KEY (from flightpath)
7+
# - DEPLOYMENT_KEY (as set on corresponding heroku app env var)
8+
run-name: Copy production to staging by @${{ github.actor }}
9+
on: [workflow_dispatch]
10+
concurrency: staging_environment
11+
jobs:
12+
run_flightpath:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python 3.11
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
python -m pip install requests
24+
- name: Run run_flightpath.py script
25+
run: |
26+
python tbx/core/utils/scripts/run_flightpath.py
27+
env:
28+
HEROKU_APP_NAME_PRODUCTION: ${{ secrets.HEROKU_APP_NAME_PRODUCTION }}
29+
HEROKU_APP_NAME_STAGING: ${{ secrets.HEROKU_APP_NAME_STAGING }}
30+
FLIGHTPATH_AUTH_KEY: ${{ secrets.FLIGHTPATH_AUTH_KEY }}
31+
DEPLOYMENT_KEY: ${{ secrets.DEPLOYMENT_KEY }}
32+
FLIGHTPATH_URL: ${{ secrets.FLIGHTPATH_URL }}

Diff for: .github/workflows/flightpath_status_check.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Flightpath status check
2+
# The following secrets are required on GitHub:
3+
# - FLIGHTPATH_URL (URL for the flightpath excluding trailing slash)
4+
# - FLIGHTPATH_AUTH_KEY (from flightpath)
5+
run-name: Check status of flightpath job ${{inputs.job_id}} by @${{ github.actor }}
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
job_id:
10+
description: 'Please provide the Flightpath job_id. You can find this in the output from run_flightpath.py when running "Copy prod to staging" Github Action.'
11+
required: true
12+
type: string
13+
jobs:
14+
run_flightpath_status_check:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Python 3.11
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.11'
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
python -m pip install requests
26+
- name: Run run_flightpath_status_check.py script
27+
run: |
28+
python tbx/core/utils/scripts/run_flightpath_status_check.py --job_id=${{ inputs.job_id }}
29+
env:
30+
FLIGHTPATH_AUTH_KEY: ${{ secrets.FLIGHTPATH_AUTH_KEY }}
31+
FLIGHTPATH_URL: ${{ secrets.FLIGHTPATH_URL }}

Diff for: .github/workflows/gh-pages.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Docs
2+
3+
on:
4+
pull_request:
5+
branches: ['master']
6+
paths:
7+
- 'docs/**/*'
8+
- 'mkdocs.yml'
9+
10+
push:
11+
branches: ['master']
12+
paths:
13+
- 'docs/**/*'
14+
- 'mkdocs.yml'
15+
16+
# Allows you to run this workflow manually from the Actions tab
17+
workflow_dispatch:
18+
19+
# Allow one concurrent deployment
20+
concurrency:
21+
group: 'pages'
22+
cancel-in-progress: true
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-22.04
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Setup Pages
34+
uses: actions/configure-pages@v3
35+
36+
- name: Set up Python
37+
uses: actions/setup-python@v4
38+
with:
39+
python-version: 3.11
40+
cache: 'pip'
41+
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
python -m pip install mkdocs==1.4.3 mkdocs-material==9.1.16 pymdown-extensions==10.0.1
46+
47+
- name: Build site (_site directory name is used for Jekyll compatiblity)
48+
run: mkdocs build --config-file ./mkdocs.yml --site-dir ./_site
49+
- name: Upload artifact
50+
uses: actions/upload-pages-artifact@v1
51+
52+
deploy:
53+
needs: build
54+
if: github.ref == 'refs/heads/master'
55+
56+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
57+
permissions:
58+
contents: read
59+
pages: write
60+
id-token: write
61+
62+
# Deploy to the github-pages environment
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
66+
67+
runs-on: ubuntu-22.04
68+
steps:
69+
- name: Deploy Docs to GitHub Pages
70+
id: deployment
71+
uses: actions/deploy-pages@v2

Diff for: .github/workflows/test.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
paths-ignore: ['docs/**']
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Set up Python 3.11
13+
uses: actions/setup-python@v3
14+
with:
15+
python-version: 3.11
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version-file: '.nvmrc'
19+
- id: node-cache
20+
uses: actions/cache@v3
21+
with:
22+
path: node_modules
23+
key: ${{ runner.os }}-node-${{ hashFiles('**/.nvmrc') }}-${{ hashFiles('**/package-lock.json') }}
24+
- if: steps.node-cache.outputs.cache-hit != 'true'
25+
run: npm ci --no-audit
26+
- uses: actions/cache@v3
27+
with:
28+
path: ${{ env.HOME }}/.cache/pre-commit
29+
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
30+
- uses: pre-commit/[email protected]
31+
test_js:
32+
runs-on: ubuntu-latest
33+
needs: lint
34+
steps:
35+
- uses: actions/checkout@v3
36+
- uses: actions/setup-node@v3
37+
with:
38+
node-version-file: '.nvmrc'
39+
- id: node-cache
40+
uses: actions/cache@v3
41+
with:
42+
path: node_modules
43+
key: ${{ runner.os }}-node-${{ hashFiles('**/.nvmrc') }}-${{ hashFiles('**/package-lock.json') }}
44+
- if: steps.node-cache.outputs.cache-hit != 'true'
45+
run: npm ci --no-audit
46+
- run: npm run lint
47+
- run: npm run build:prod
48+
test_python:
49+
needs: lint
50+
runs-on: ubuntu-latest
51+
52+
env:
53+
DJANGO_SETTINGS_MODULE: tbx.settings.test
54+
DATABASE_URL: postgres://postgres:postgres@localhost/postgres # pragma: allowlist secret
55+
CFG_SECRET_KEY: iamnotsosecret
56+
CFG_ALLOWED_HOSTS: localhost
57+
58+
services:
59+
postgres:
60+
image: postgres:13.12
61+
env:
62+
POSTGRES_USER: postgres
63+
POSTGRES_PASSWORD: postgres # pragma: allowlist secret
64+
POSTGRES_DB: postgres
65+
ports:
66+
- 5432:5432
67+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
68+
69+
steps:
70+
- uses: actions/checkout@v3
71+
- name: Install Poetry
72+
run: pipx install poetry==1.5.1 # Make sure this matches POETRY_VERSION in the Dockerfile
73+
- name: Set up Python
74+
uses: actions/setup-python@v4
75+
with:
76+
python-version: 3.11
77+
cache: 'poetry'
78+
- name: Install Python dependencies
79+
run: poetry install
80+
- name: System checks
81+
run: poetry run ./manage.py check
82+
- name: Check for missing migrations
83+
run: poetry run ./manage.py makemigrations --check --noinput
84+
- name: Test
85+
run: poetry run ./manage.py test

Diff for: .gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
*.pyc
2+
.DS_Store
3+
*.swp
4+
/venv/
5+
/.venv/
6+
.env
7+
.python-version
8+
/static/
9+
static_compiled/
10+
/media/
11+
/media.old/
12+
/tmp/
13+
/docs/_build/
14+
.idea/
15+
node_modules*
16+
/None
17+
*.log
18+
/.vscode/*
19+
!/.vscode/launch.json
20+
/database_dumps/

Diff for: .isort.cfg

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[settings]
2+
default_section=FIRSTPARTY
3+
force_grid_wrap=0
4+
include_trailing_comma=True
5+
known_django=django
6+
known_first_party=tbx
7+
multi_line_output=3
8+
sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
9+
skip=migrations,node_modules,venv,.venv,.git
10+
use_parentheses=True

Diff for: .nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

0 commit comments

Comments
 (0)