Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/aws-actions/config…
Browse files Browse the repository at this point in the history
…ure-aws-credentials-4
  • Loading branch information
tom-webber authored Mar 1, 2024
2 parents 248c689 + 16f0b89 commit b977a12
Show file tree
Hide file tree
Showing 105 changed files with 11,288 additions and 1,614 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: deploy

on:
push:
branches:
branches:
[main]
workflow_dispatch:

Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/format-code.yml

This file was deleted.

83 changes: 83 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: test
# based on https://jacobian.org/til/github-actions-poetry/

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11.1
- name: cache poetry install
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-1.7.1-0
- uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- run: poetry install --no-interaction
- name: run unit tests with coverage
id: fast-tests
run: poetry run pytest --cov -m 'not slow'

- name: Get Chromium version 🌐
run: |
CHROMIUM_VERSION=$(google-chrome --product-version)
echo "Chromium version: $CHROMIUM_VERSION"
echo "CHROMIUM_VERSION=$CHROMIUM_VERSION" >> $GITHUB_ENV
- name: Install chromedriver 🚗
run: |
npm install -g chromedriver@${CHROMIUM_VERSION%.*.*}
- name: run selenium tests
id: slow-tests
if: steps.fast-tests.outcome == 'success'
run: poetry run pytest -m 'slow' --chromedriver-path=$(npm root -g)/chromedriver/bin/chromedriver

test_javascript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "21"

- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- uses: actions/cache@v4
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
id: install_dependencies
run: npm install

- name: Run javascript tests
run: npm test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,7 @@ cython_debug/
staticfiles/

node_modules

tmp/

coverage
36 changes: 34 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,47 @@ repos:
exclude: tf$|j2$

- repo: https://github.com/psf/black
rev: 23.11.0
rev: 23.12.1
hooks:
- id: black
name: black formatting
args: [--config=./pyproject.toml]
# args: [--config=./pyproject.toml]

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
name: flake8 lint
args: [
'--ignore=E203,E266,W503,F403',
'--exclude=".git, .mypy_cache, .pytest_cache, build, dist"',
'--max-line-length=89',
'--max-complexity=18',
'--select="B,C,E,F,W,T4,B9"'
]
additional_dependencies:
- flake8-broken-line
- flake8-bugbear
- flake8-comprehensions
- flake8-debugger
- flake8-string-format

- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
args: ["--baseline", ".secrets.baseline"]
exclude: package.lock.json

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
additional_dependencies: ["toml"]

- repo: https://github.com/floatingpurr/sync_with_poetry
rev: "1.1.0"
hooks:
- id: sync_with_poetry
args: []
122 changes: 122 additions & 0 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"version": "1.4.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
},
{
"name": "AWSKeyDetector"
},
{
"name": "AzureStorageKeyDetector"
},
{
"name": "Base64HighEntropyString",
"limit": 4.5
},
{
"name": "BasicAuthDetector"
},
{
"name": "CloudantDetector"
},
{
"name": "DiscordBotTokenDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
},
{
"name": "IbmCloudIamDetector"
},
{
"name": "IbmCosHmacDetector"
},
{
"name": "JwtTokenDetector"
},
{
"name": "KeywordDetector",
"keyword_exclude": ""
},
{
"name": "MailchimpDetector"
},
{
"name": "NpmDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "SendGridDetector"
},
{
"name": "SlackDetector"
},
{
"name": "SoftlayerDetector"
},
{
"name": "SquareOAuthDetector"
},
{
"name": "StripeDetector"
},
{
"name": "TwilioKeyDetector"
}
],
"filters_used": [
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"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": {
"templates/base/base.html": [
{
"type": "Base64 High Entropy String",
"filename": "templates/base/base.html",
"hashed_secret": "f6538b22f89b1e2b05570de751f2932c6bca9969",
"is_verified": false,
"line_number": 40
}
]
},
"generated_at": "2024-02-21T10:23:47Z"
}
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Django",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": ["runserver"],
"django": true
}
]
}
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
FROM node:21-bullseye as node_builder

WORKDIR /app
COPY . .

RUN npm install && npm run sass

# The builder image, used to build the virtual environment
FROM python:3.11-buster as builder

WORKDIR /app
COPY --from=node_builder /app .

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
Expand All @@ -13,9 +23,6 @@ ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

# set work directory
WORKDIR /app

COPY pyproject.toml poetry.lock ./

RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR
Expand Down
Loading

0 comments on commit b977a12

Please sign in to comment.