Skip to content

Commit

Permalink
Merge pull request #1 from uktrade/adds-dockerised-django-app
Browse files Browse the repository at this point in the history
Adds dockerised django app and postgres database
  • Loading branch information
gdbarnes authored Sep 11, 2024
2 parents 7b12ae1 + a5d36dc commit 0df11bf
Show file tree
Hide file tree
Showing 62 changed files with 7,791 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .copilot/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
repository: orp
builder:
name: paketobuildpacks/builder-jammy-full
version: 0.3.339
11 changes: 11 additions & 0 deletions .copilot/image_build_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

# Exit early if something goes wrong
set -e

# Add commands below to run inside the container after all the other buildpacks have been applied
export BUILD_STEP='True'
export COPILOT_ENVIRONMENT_NAME='build'
export DJANGO_SETTINGS_MODULE="config.settings.base"

poetry run python orp/manage.py collectstatic --noinput
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.git
.github
.gitignore
.idea
.vscode
.mypy_cache
.pre-commit-config.yaml
CODEOWNERS
LICENSE
Makefile
README.md
__pycache__
adr
docs
paas_entrypoint.sh
Procfile
.copilot/
80 changes: 80 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Code Quality Checks

on: [push]

jobs:
lint:
name: Run lint checks
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install dependencies
run: |
pip install poetry
poetry install --only dev
- name: black
run: poetry run pre-commit run black --all-files

- name: isort
run: poetry run pre-commit run isort --all-files

- name: flake8
run: poetry run pre-commit run flake8 --all-files

- name: detect-secrets
run: poetry run pre-commit run detect-secrets --all-files

- name: mypy
run: poetry run pre-commit run mypy --all-files

- name: bandit
run: poetry run pre-commit run bandit --all-files
test:
name: Run unit tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install dependencies
run: |
pip install poetry
poetry install --without dev
- name: Build bundle
run: |
npm install
npm run build
DJANGO_SETTINGS_MODULE=config.settings.local poetry run orp/manage.py collectstatic --noinput
# - name: Run tests
# run: poetry run pytest orp/tests

# - name: Generate coverage report
# run: poetry run coverage xml

# - name: Upload coverage report
# uses: actions/upload-artifact@v4
# with:
# name: coverage
# path: coverage.xml
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ cover/
local_settings.py
db.sqlite3
db.sqlite3-journal
prompt_payments/static
orp/static

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
Expand Down
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
args: [--check, --diff] # diff is required for Github workflow
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args:
- --check
- --diff # diff is required for Github workflow
- --profile black
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: [--baseline, .secrets.baseline]
exclude: poetry.lock
- repo: https://github.com/pycqa/bandit
rev: '1.7.8'
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.10.0'
hooks:
- id: mypy
168 changes: 168 additions & 0 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
{
"version": "1.5.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
},
{
"name": "AWSKeyDetector"
},
{
"name": "AzureStorageKeyDetector"
},
{
"name": "Base64HighEntropyString",
"limit": 4.5
},
{
"name": "BasicAuthDetector"
},
{
"name": "CloudantDetector"
},
{
"name": "DiscordBotTokenDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "GitLabTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
},
{
"name": "IbmCloudIamDetector"
},
{
"name": "IbmCosHmacDetector"
},
{
"name": "IPPublicDetector"
},
{
"name": "JwtTokenDetector"
},
{
"name": "KeywordDetector",
"keyword_exclude": ""
},
{
"name": "MailchimpDetector"
},
{
"name": "NpmDetector"
},
{
"name": "OpenAIDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "PypiTokenDetector"
},
{
"name": "SendGridDetector"
},
{
"name": "SlackDetector"
},
{
"name": "SoftlayerDetector"
},
{
"name": "SquareOAuthDetector"
},
{
"name": "StripeDetector"
},
{
"name": "TelegramBotTokenDetector"
},
{
"name": "TwilioKeyDetector"
}
],
"filters_used": [
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
},
{
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
},
{
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
},
{
"path": "detect_secrets.filters.heuristic.is_lock_file"
},
{
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
},
{
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
},
{
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
},
{
"path": "detect_secrets.filters.heuristic.is_sequential_string"
},
{
"path": "detect_secrets.filters.heuristic.is_swagger_file"
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret"
}
],
"results": {
"Makefile": [
{
"type": "Basic Auth Credentials",
"filename": "Makefile",
"hashed_secret": "afc848c316af1a89d49826c5ae9d00ed769415f3",
"is_verified": false,
"line_number": 102
}
],
"orp/tests/conftest.py": [
{
"type": "Secret Keyword",
"filename": "orp/tests/conftest.py",
"hashed_secret": "ff84e88d512a74e0763b73780b819937e28100cf",
"is_verified": false,
"line_number": 17
}
],
"orp/tests/core/test_companies_house.py": [
{
"type": "Secret Keyword",
"filename": "orp/tests/core/test_companies_house.py",
"hashed_secret": "ff84e88d512a74e0763b73780b819937e28100cf",
"is_verified": false,
"line_number": 10
}
],
"orp/tests/data/mock_ch_profile_response.json": [
{
"type": "Base64 High Entropy String",
"filename": "orp/tests/data/mock_ch_profile_response.json",
"hashed_secret": "da6511f97b6d20a5390ea9afd4c155f9d7236613",
"is_verified": false,
"line_number": 44
}
]
},
"generated_at": "2024-09-09T12:08:54Z"
}
2 changes: 2 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The Open Regulation Platform team maintain the orp service
* @uktrade/orp
Loading

0 comments on commit 0df11bf

Please sign in to comment.