Skip to content

Commit

Permalink
Merge branch 'release-prep' into 'master'
Browse files Browse the repository at this point in the history
Release prep

See merge request buckinghamshire-council/bc!781
  • Loading branch information
nickmoreton committed Nov 11, 2024
2 parents 329cd60 + 0af7300 commit f4522a2
Show file tree
Hide file tree
Showing 281 changed files with 521 additions and 822 deletions.
14 changes: 7 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ static:
poetry:
# If you update the python image version here, make sure you update all jobs that depend on this
# and the version in the Dockerfile and provision scripts as well
image: python:3.8-bullseye
image: python:3.11-bullseye
stage: build
variables:
POETRY_VERSION: 1.8.3
POETRY_VERSION: 1.8.4
script:
- pip install poetry==$POETRY_VERSION
- python -m venv venv
Expand All @@ -70,7 +70,7 @@ poetry:

# Check python code style.
flake8:
image: python:3.8-bullseye
image: python:3.11-bullseye
stage: test
dependencies:
- poetry
Expand All @@ -82,7 +82,7 @@ flake8:
# Check imports sort order, i.e. check whether they are in an alphabetical
# order and grouped properly.
isort:
image: python:3.8-bullseye
image: python:3.11-bullseye
stage: test
dependencies:
- poetry
Expand Down Expand Up @@ -111,7 +111,7 @@ lint_format:

# Run black and check for changes
black:
image: python:3.8-bullseye
image: python:3.11-bullseye
stage: test
dependencies:
- poetry
Expand All @@ -123,7 +123,7 @@ black:
# Check settings, migrations and run tests.
test_python:
# Make sure this Python version matches the version in your Dockerfile.
image: python:3.8-bullseye
image: python:3.11-bullseye
extends: .cache_static
stage: test
needs:
Expand Down Expand Up @@ -241,7 +241,7 @@ deploy_content_prep:
<<: *heroku_deployment_template

pages:
image: python:3.8
image: python:3.11
stage: pages
only:
- master
Expand Down
26 changes: 22 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
default_language_version:
node: system
python: python3.11

repos:
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 7.0.0
hooks:
- id: flake8
language_version: python3
- repo: https://github.com/python/black
rev: 24.4.2
hooks:
- id: black
language_version: python3
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
hooks:
- id: pyupgrade
- repo: https://github.com/adamchainz/django-upgrade
rev: '1.16.0' # replace with latest tag on GitHub
hooks:
- id: django-upgrade
args: [--target-version, '4.2'] # Replace with Django version
- repo: https://github.com/python-poetry/poetry
rev: '1.8.2' # keep version in sync with version installed in the Dockerfile
hooks:
- id: poetry-check
- id: poetry-lock
# Never update dependencies and only run on changes to pyproject.toml
args: [--no-update]
files: ^pyproject.toml$
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v6.5.1
hooks:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release History

## Unreleased

## 80.2 (2024-11-11)

Compare: <https://git.torchbox.com/buckinghamshire-council/bc/compare/80.1...80.2>

- upgrade python to 3.11

## 80.1 (2024-10-15)

Compare: <https://git.torchbox.com/buckinghamshire-council/bc/compare/80.0...80.1>
Expand Down
37 changes: 16 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ RUN npm run build:prod
# ones becase they use a different C compiler. Debian images also come with
# all useful packages required for image manipulation out of the box. They
# however weight a lot, approx. up to 1.5GiB per built image.
FROM python:3.8-bullseye as backend
FROM python:3.11-slim as backend

ARG POETRY_HOME=/opt/poetry
ARG POETRY_INSTALL_ARGS="--no-dev"
ARG POETRY_INSTALL_ARGS="--without=dev"

# IMPORTANT: Remember to review both of these when upgrading
ARG POETRY_VERSION=1.8.3
ARG POETRY_VERSION=1.8.4

# Install dependencies in a virtualenv
ENV VIRTUAL_ENV=/venv
Expand All @@ -40,23 +39,17 @@ WORKDIR /app
# * PATH - Make sure that Poetry is on the PATH, along with our venv
# * PYTHONUNBUFFERED - This is useful so Python does not hold any messages
# from being output.
# https://docs.python.org/3.8/using/cmdline.html#envvar-PYTHONUNBUFFERED
# https://docs.python.org/3.8/using/cmdline.html#cmdoption-u
# https://docs.python.org/3.12/using/cmdline.html#envvar-PYTHONUNBUFFERED
# https://docs.python.org/3.12/using/cmdline.html#cmdoption-u
# * DJANGO_SETTINGS_MODULE - default settings used in the container.
# * PORT - default port used. Please match with EXPOSE so it works on Dokku.
# Heroku will ignore EXPOSE and only set PORT variable. PORT variable is
# read/used by Gunicorn.
# * WEB_CONCURRENCY - number of workers used by Gunicorn. The variable is
# read by Gunicorn.
# * GUNICORN_CMD_ARGS - additional arguments to be passed to Gunicorn. This
# variable is read by Gunicorn
ENV PATH=$VIRTUAL_ENV/bin:$PATH \
POETRY_INSTALL_ARGS=${POETRY_INSTALL_ARGS} \
PYTHONUNBUFFERED=1 \
DJANGO_SETTINGS_MODULE=bc.settings.production \
PORT=8000 \
WEB_CONCURRENCY=3 \
GUNICORN_CMD_ARGS="-c gunicorn-conf.py --max-requests 1200 --max-requests-jitter 50 --access-logfile - --timeout 25"
PORT=8000

# Make $BUILD_ENV available at runtime
ARG BUILD_ENV
Expand All @@ -66,16 +59,16 @@ ENV BUILD_ENV=${BUILD_ENV}
# server (Gunicorn). This is read by Dokku only. Heroku will ignore this.
EXPOSE 8000

RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
build-essential \
libpq-dev \
curl \
git \
&& apt-get autoremove && rm -rf /var/lib/apt/lists/*

# Install poetry at the system level
RUN pip install --no-cache poetry==${POETRY_VERSION}

# Copy gunicorn config overrides.
COPY gunicorn-conf.py ./

COPY --chown=bc --from=frontend ./bc/static_compiled ./bc/static_compiled

WORKDIR /app

# Don't use the root user as it's an anti-pattern and Heroku does not run
# containers as root either.
# https://devcenter.heroku.com/articles/container-registry-and-runtime#dockerfile-commands-and-runtime
Expand All @@ -86,6 +79,8 @@ RUN python -m venv $VIRTUAL_ENV
COPY --chown=bc pyproject.toml poetry.lock ./
RUN pip install --no-cache --upgrade pip && poetry install ${POETRY_INSTALL_ARGS} --no-root --extras gunicorn && rm -rf $HOME/.cache

COPY --chown=bc --from=frontend ./bc/static_compiled ./bc/static_compiled

# Copy application code.
COPY --chown=bc . .

Expand All @@ -103,7 +98,7 @@ COPY ./docker/bashrc.sh /home/bc/.bashrc

# Run the WSGI server. It reads GUNICORN_CMD_ARGS, PORT and WEB_CONCURRENCY
# environment variable hence we don't specify a lot options below.
CMD gunicorn bc.wsgi:application
CMD ["gunicorn"]

# These steps won't be run on production
FROM backend as dev
Expand Down
3 changes: 1 addition & 2 deletions bc/alerts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Generated by Django 2.2.13 on 2020-07-08 16:40

import django.db.models.deletion
from django.db import migrations, models

import wagtail.fields
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
3 changes: 1 addition & 2 deletions bc/alerts/migrations/0003_alter_alert_content.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Generated by Django 3.2.9 on 2022-05-02 07:47

from django.db import migrations

import wagtail.fields
from django.db import migrations


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion bc/blogs/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Generated by Django 3.2.9 on 2022-05-25 07:42

from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
3 changes: 1 addition & 2 deletions bc/blogs/migrations/0002_blogpostpage.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Generated by Django 3.2.9 on 2022-05-31 05:38

import django.db.models.deletion
from django.db import migrations, models

import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.contrib.typed_table_block.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations, models

import bc.utils.blocks

Expand Down
2 changes: 1 addition & 1 deletion bc/blogs/migrations/0003_featured_blogpost.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 3.2.9 on 2022-05-31 05:39

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion bc/blogs/migrations/0004_add_social_links_bloghomepage.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Generated by Django 3.2.9 on 2022-05-25 11:15

import bc.utils.validators
from django.db import migrations, models

import bc.utils.validators


class Migration(migrations.Migration):

Expand Down
2 changes: 1 addition & 1 deletion bc/blogs/migrations/0006_alter_bloghomepage_about_page.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 3.2.9 on 2022-06-10 05:00

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion bc/blogs/migrations/0007_blogglobalhomepage.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 3.2.9 on 2022-06-15 18:23

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion bc/blogs/migrations/0008_blogalertsubscription.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 3.2.9 on 2022-06-05 17:28

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
3 changes: 1 addition & 2 deletions bc/blogs/migrations/0008_bloghomepagecategories.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Generated by Django 3.2.13 on 2022-07-11 19:49

import django.db.models.deletion
from django.db import migrations, models

import modelcluster.fields
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
3 changes: 1 addition & 2 deletions bc/blogs/migrations/0011_blogaboutpage.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Generated by Django 3.2.13 on 2022-07-13 15:39

import django.db.models.deletion
from django.db import migrations, models

import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.contrib.typed_table_block.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations, models

import bc.utils.blocks

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Generated by Django 3.2.13 on 2022-08-02 12:31

from django.db import migrations

import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.contrib.typed_table_block.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations

import bc.utils.blocks

Expand Down
3 changes: 1 addition & 2 deletions bc/blogs/migrations/0013_wagtail_3_upgrade.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Generated by Django 3.2.13 on 2022-08-24 13:49

from django.db import migrations

import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.contrib.typed_table_block.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations

import bc.utils.blocks

Expand Down
3 changes: 1 addition & 2 deletions bc/blogs/migrations/0015_add_markdown_links_to_table.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Generated by Django 3.2.13 on 2023-02-09 04:24

from django.db import migrations

import wagtail.blocks
import wagtail.contrib.typed_table_block.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations

import bc.utils.blocks

Expand Down
3 changes: 1 addition & 2 deletions bc/blogs/migrations/0016_add_help_text_to_plain_tables.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Generated by Django 3.2.13 on 2023-03-07 13:19

from django.db import migrations

import wagtail.blocks
import wagtail.contrib.typed_table_block.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations

import bc.utils.blocks

Expand Down
3 changes: 1 addition & 2 deletions bc/blogs/migrations/0017_tableblock_help_text.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Generated by Django 3.2.13 on 2023-04-27 16:07

from django.db import migrations

import wagtail.blocks
import wagtail.contrib.typed_table_block.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations

import bc.utils.blocks

Expand Down
Loading

0 comments on commit f4522a2

Please sign in to comment.