Skip to content

Commit

Permalink
Use the latest containers (#1743)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood authored Jan 6, 2025
2 parents be292dd + 616f91d commit 70b08cb
Show file tree
Hide file tree
Showing 340 changed files with 47,378 additions and 51,071 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
omit =
config/*
docs/*
dev/*
etna/**/migrations/*
etna/**/tests/*
fabfile.py
gunicorn.conf.py
manage.py
source = .
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
Dockerfile
README.md
babel.config.json
database_dumps
dev
docker-compose.yml
docs
fabfile.py
gunicorn.conf.py
lint-requirements.txt
media
Expand Down
8 changes: 0 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
DATABASE_ENGINE=django.db.backends.postgresql
DATABASE_NAME=postgres
DATABASE_USER=postgres
DATABASE_HOST=db
PLATFORM_PROJECT_ID=
KONG_CLIENT_BASE_URL=
KONG_IMAGE_PREVIEW_BASE_URL=
KONG_CLIENT_KEY=
KONG_CLIENT_VERIFY_CERTIFICATES=True
KONG_CLIENT_TEST_MODE=False
KONG_CLIENT_TEST_FILENAME=records.json
PLATFORMSH_CLI_TOKEN=your-api-token-here
12 changes: 8 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ module.exports = {
env: {
browser: true,
es2021: true,
jquery: true,
jest: true,
},
extends: ["eslint:recommended"],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js}"],
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
Expand All @@ -22,5 +20,11 @@ module.exports = {
sourceType: "module",
},
rules: {},
ignorePatterns: ["templates/static/scripts/**/*.js", ".*.js", "*.config.js"],
ignorePatterns: [
"templates/static/scripts/**/*.js",
".*.js",
"*.test.js",
"*.config.js",
"static",
],
};
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
ignore = E203, E266, E501, W503, F403, F401
exclude = venv*,__pycache__,node_modules,migrations
max-line-length = 88
max-complexity = 12
select = B,C,E,F,W,T4,B9
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ updates:
versioning-strategy: "increase-if-necessary"
directory: "/"
schedule:
interval: "weekly"
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
Expand Down
4 changes: 3 additions & 1 deletion .github/scripts/check_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ def get_diff():
merging develop into the main branch.
"""
subprocess.run(
["git", "fetch", "origin"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
["git", "fetch", "origin"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
output = [
f"./{file_path}"
Expand Down
26 changes: 4 additions & 22 deletions .github/workflows/_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: "pip"
cache-dependency-path: "**/lint-requirements.txt"
- run: pip install -r lint-requirements.txt
- name: Check compliance with flake8
run: flake8 .
- run: pip install flake8 isort black
- name: Check compliance with isort
run: isort -c .
- name: Check compliance with Black
run: black etna config --check --fast
run: black -t py38 -t py39 -t py310 -t py311 -t py312 --line-length 88 --verbose etna config
- name: Check compliance with flake8
run: flake8 .

test-python:
name: Test Python
Expand Down Expand Up @@ -76,25 +74,10 @@ jobs:
run: poetry run coverage run manage.py test etna
- name: Check for missing migrations
run: poetry run python manage.py makemigrations --check --noinput

prettier:
name: Prettier format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install npm modules
run: npm install
- name: Lint SCSS and JS and run prettier
run: npm run lint

compile-javascript:
name: Compile JavaScript
runs-on: ubuntu-latest
needs: prettier
steps:
- uses: actions/checkout@v4
- name: Set up Node
Expand Down Expand Up @@ -124,7 +107,6 @@ jobs:
compile-scss:
name: Compile SCSS
runs-on: ubuntu-latest
needs: prettier
steps:
- uses: actions/checkout@v4
- name: Set up Node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/branch-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
owner: ${{ github.repository_owner }}
name: ${{ vars.DOCKER_IMAGE_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.version-tag.outputs.VERSION }}
tag: ${{ steps.version-tag.outputs.VERSION }}
6 changes: 3 additions & 3 deletions .github/workflows/check-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Check Migrations
on:
pull_request:
paths:
- 'etna/*/migrations/**'
- "etna/*/migrations/**"

jobs:
check-migrations:
Expand All @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: "3.10"

- name: Check migrations
run: python .github/scripts/check_migrations.py
run: python .github/scripts/check_migrations.py
2 changes: 1 addition & 1 deletion .github/workflows/create-release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Create pull request
run: gh pr create -B ${{ steps.extract_branch.outputs.BRANCH }} -H "release/v${{ steps.version-tag.outputs.CALVER }}" --title "Version ${{ steps.version-tag.outputs.CALVER }}" --body "Created by Github action https://github.com/nationalarchives/ds-wagtail/actions/runs/${{ github.run_id }}" --no-maintainer-edit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Merge the pull request
# run: gh pr merge "release/v${{ steps.version-tag.outputs.CALVER }}" --admin --merge
# env:
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/platformsh-cd-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ on:
- develop
paths:
# Host config
- '.plaform/**'
- '.platform.app.yaml'
- 'gunicorn.conf.py'
- ".plaform/**"
- ".platform.app.yaml"
- "gunicorn.conf.py"
# Python config
- 'poetry.lock'
- 'pyproject.toml'
- "poetry.lock"
- "pyproject.toml"
# NPM config
- 'package.json'
- 'package-lock.json'
- 'webpack.config.js'
- "package.json"
- "package-lock.json"
- "webpack.config.js"
# App changes
- 'config/**'
- 'sass/**'
- 'scripts/**'
- 'templates/**'
- 'etna/**'
- "config/**"
- "sass/**"
- "scripts/**"
- "templates/**"
- "etna/**"

jobs:
ci:
Expand Down Expand Up @@ -53,8 +53,8 @@ jobs:
runs-on: ubuntu-latest
needs: deploy
steps:
- uses: actions/checkout@v4
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "A deployment to develop is complete"
- uses: actions/checkout@v4
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "A deployment to develop is complete"
10 changes: 5 additions & 5 deletions .github/workflows/platformsh-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
runs-on: ubuntu-latest
needs: deploy
steps:
- uses: actions/checkout@v4
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "A deployment to main is complete"
- uses: actions/checkout@v4
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "A deployment to main is complete"
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ templates/static
/static/*
!/static/.gitkeep

# Ignore the contents of /database_dumps but keep the directory
/database_dumps/*
!/database_dumps/.gitkeep

# Database backups
/db/

Expand Down
3 changes: 3 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
profile = black
skip = migrations
26 changes: 13 additions & 13 deletions .platform.app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ name: app
# in multiple versions. Check the Python documentation
# (https://docs.platform.sh/languages/python.html#supported-versions)
# to find the supported versions for the 'python' type.
type: 'python:3.12'
type: "python:3.12"

dependencies:
python3:
poetry: '1.8.1'
poetry: "1.8.1"

variables:
env:
DJANGO_SETTINGS_MODULE: 'config.settings.platform'
DJANGO_SETTINGS_MODULE: "config.settings.platform"
# pip
POETRY_VIRTUALENVS_IN_PROJECT: true
POETRY_VIRTUALENVS_CREATE: true
Expand All @@ -30,14 +30,14 @@ disk: 4608
# to the application in the PLATFORM_RELATIONSHIPS variable. The right-hand
# side is in the form <service name>:<endpoint name>.
relationships:
db: 'db:postgresql'
redis: "redis:redis"
db: "db:postgresql"
redis: "redis:redis"

hooks:
build: |
# Add platform CLI
curl -sS https://platform.sh/cli/installer | php
# Download the latest version of pip
python3.12 -m pip install --upgrade pip
Expand All @@ -49,7 +49,7 @@ hooks:
export NVM_DIR="$PLATFORM_APP_DIR/.nvm"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install
npm install
mkdir -p templates/static/assets
Expand All @@ -72,11 +72,11 @@ web:
allow: false
rules:
'^/favicon\.ico$':
allow: false
allow: false
"/static":
# Allow liberal controls to allow CORS for admin font assets
headers:
Access-Control-Allow-Origin: '*'
Access-Control-Allow-Origin: "*"
root: static
expires: 1y
allow: true
Expand Down Expand Up @@ -105,13 +105,13 @@ crons:
# Publish scheduled pages once every half an hour
# https://docs.wagtail.org/en/stable/reference/management_commands.html#publish-scheduled
publish_scheduled:
spec: '*/30 * * * *'
spec: "*/30 * * * *"
cmd: poetry run python manage.py publish_scheduled

# Take snapshot at 5am every morning
# https://docs.platform.sh/administration/snapshot-and-restore.html#automated-snapshots
snapshot:
spec: '0 5 * * *'
spec: "0 5 * * *"
cmd: |
if [ "$PLATFORM_BRANCH" = main ]; then
platform backup:create --yes --no-wait
Expand All @@ -120,8 +120,8 @@ crons:
# Renew cert by forcing a redeploy at 4 am (UTC) on the 1st and 15th of every month.
# https://docs.platform.sh/configuration/routes/https.html#automatic-ssl-certificate-renewal
renewcert:
spec: '0 4 1,15 * *'
spec: "0 4 1,15 * *"
cmd: |
if [ "$PLATFORM_BRANCH" = main ]; then
platform redeploy --yes --no-wait
fi
fi
36 changes: 18 additions & 18 deletions .platform/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Each route describes how an incoming URL is going to be processed by Platform.sh.

"https://{default}/":
type: upstream
upstream: "app:http"
cache:
enabled: true
default_ttl: 300
cookies:
- sessionid
- csrftoken
- messages
- csrftoken
- cookies_policy
- dontShowCookieNotice
- beta_banner_dismissed
headers:
- Accept
- Vary
type: upstream
upstream: "app:http"
cache:
enabled: true
default_ttl: 300
cookies:
- sessionid
- csrftoken
- messages
- csrftoken
- cookies_policy
- dontShowCookieNotice
- beta_banner_dismissed
headers:
- Accept
- Vary

# Redirect www routes to preseve links to old plaform.sh domain
"https://www.{default}/":
type: redirect
to: "https://{default}/"
type: redirect
to: "https://{default}/"
Loading

0 comments on commit 70b08cb

Please sign in to comment.