Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ max-line-length = 100
max-complexity = 10
exclude =
.git
.venv
__pycache__
app/storage/migrations/versions
55 changes: 26 additions & 29 deletions .github/workflows/gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,24 @@ on:
pull_request:

env:
PYTHON_VERSION: '3.11'
PYTHON_VERSION: '3.12'

jobs:
check-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
# https://docs.astral.sh/uv/guides/integration/github/
- name: set up python and uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pipenv'
- name: install dependencies
run: |
pip install pipenv
run: uv sync --locked --all-extras --dev
- name: check style
run: |
pipenv install --dev
pipenv run flake8
run: uv run flake8

check-web-style:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -58,18 +57,16 @@ jobs:
SQLALCHEMY_DATABASE_URI: postgresql://postgres:postgres@localhost/postgres
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
- name: set up python and uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pipenv'
- name: install dependencies
run: |
pip install pipenv
pipenv install --dev
run: uv sync --locked --all-extras --dev
- name: run unit tests
run: |
pipenv run pytest --cov-report term --cov=app tests/unit
run: uv run pytest --cov-report term --cov=app tests/unit

run-system-tests:
runs-on: ubuntu-latest
Expand All @@ -96,27 +93,27 @@ jobs:
TEST_PW: abc123xyz789
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
- name: set up python and uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pipenv'
- name: install dependencies
run: |
pip install pipenv
pipenv install --dev
pipenv run playwright install chromium
uv sync --locked --all-extras --dev
uv run playwright install chromium
- name: initialise db
run: |
ENV=CI pipenv run flask --app app.app db upgrade --directory app/storage/migrations
ENV=CI pipenv run flask --app app.app roles create superuser
ENV=CI pipenv run flask --app app.app users create $TEST_USER --password $TEST_PW -a
ENV=CI pipenv run flask --app app.app roles add $TEST_USER superuser
ENV=CI uv run flask --app app.app db upgrade --directory app/storage/migrations
ENV=CI uv run flask --app app.app roles create superuser
ENV=CI uv run flask --app app.app users create $TEST_USER --password $TEST_PW -a
ENV=CI uv run flask --app app.app roles add $TEST_USER superuser
- name: start server
run: |
ENV=CI pipenv run flask --app app.app run & \
ENV=CI uv run flask --app app.app run & \
sleep 3 && \
curl http://localhost:5000 -I
- name: run system tests
run: |
ENV=CI pipenv run pytest tests/system
ENV=CI uv run pytest tests/system
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM python:3.11-slim
FROM python:3.12-slim

ENV PIP_NO_CACHE_DIR=1
ENV UV_COMPILE_BYTECODE=1

COPY Pipfile Pipfile.lock .
COPY --from=ghcr.io/astral-sh/uv:0.7.14 /uv /uvx /bin/
COPY pyproject.toml uv.lock .

# FIXME: update and properly follow https://docs.astral.sh/uv/guides/integration/docker/
RUN apt-get update && \
apt-get install -y --no-install-recommends vim libpq-dev build-essential && \
pip install -U pip && pip install pipenv && \
CI=1 PIPENV_NOSPIN=1 pipenv install --system --deploy && \
CI=1 uv sync --locked && \
apt-get purge -y --auto-remove build-essential && \
apt-get autoremove -y --purge && \
apt-get clean && \
Expand Down
29 changes: 0 additions & 29 deletions Pipfile

This file was deleted.

Loading