Skip to content

Commit 9f25354

Browse files
authored
Merge branch 'master' into master
2 parents e3a9cbe + 00e55cc commit 9f25354

23 files changed

+8973
-1753
lines changed

.github/workflows/generate-client.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
enable-cache: true
3434
- name: Install dependencies
3535
run: npm ci
36-
working-directory: frontend
3736
- run: uv sync
3837
working-directory: backend
3938
- run: uv run bash scripts/generate-client.sh

.github/workflows/lint-backend.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/playwright.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ jobs:
9999
node-version: 20
100100
- name: Install dependencies
101101
run: npm ci
102-
working-directory: frontend
103102
- name: Download blob reports from GitHub Actions Artifacts
104103
uses: actions/download-artifact@v7
105104
with:

.github/workflows/pre-commit.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
env:
10+
# Forks and Dependabot don't have access to secrets
11+
HAS_SECRETS: ${{ secrets.PRE_COMMIT != '' }}
12+
13+
jobs:
14+
pre-commit:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Dump GitHub context
18+
env:
19+
GITHUB_CONTEXT: ${{ toJson(github) }}
20+
run: echo "$GITHUB_CONTEXT"
21+
- uses: actions/checkout@v6
22+
name: Checkout PR for own repo
23+
if: env.HAS_SECRETS == 'true'
24+
with:
25+
# To be able to commit it needs to fetch the head of the branch, not the
26+
# merge commit
27+
ref: ${{ github.head_ref }}
28+
# And it needs the full history to be able to compute diffs
29+
fetch-depth: 0
30+
# A token other than the default GITHUB_TOKEN is needed to be able to trigger CI
31+
token: ${{ secrets.PRE_COMMIT }}
32+
# pre-commit lite ci needs the default checkout configs to work
33+
- uses: actions/checkout@v6
34+
name: Checkout PR for fork
35+
if: env.HAS_SECRETS == 'false'
36+
with:
37+
# To be able to commit it needs the head branch of the PR, the remote one
38+
ref: ${{ github.event.pull_request.head.sha }}
39+
fetch-depth: 0
40+
- uses: actions/setup-node@v6
41+
with:
42+
node-version: lts/*
43+
- name: Set up Python
44+
uses: actions/setup-python@v6
45+
with:
46+
python-version: "3.11"
47+
- name: Setup uv
48+
uses: astral-sh/setup-uv@v7
49+
with:
50+
cache-dependency-glob: |
51+
requirements**.txt
52+
pyproject.toml
53+
uv.lock
54+
- name: Install backend dependencies
55+
run: uv sync --all-packages
56+
- name: Install frontend dependencies
57+
run: npm ci
58+
- name: Run prek - pre-commit
59+
id: precommit
60+
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
61+
continue-on-error: true
62+
- name: Commit and push changes
63+
if: env.HAS_SECRETS == 'true'
64+
run: |
65+
git config user.name "github-actions[bot]"
66+
git config user.email "github-actions[bot]@users.noreply.github.com"
67+
git add -A
68+
if git diff --staged --quiet; then
69+
echo "No changes to commit"
70+
else
71+
git commit -m "🎨 Auto format"
72+
git push
73+
fi
74+
- uses: pre-commit-ci/lite-action@v1.1.0
75+
if: env.HAS_SECRETS == 'false'
76+
with:
77+
msg: 🎨 Auto format
78+
- name: Error out on pre-commit errors
79+
if: steps.precommit.outcome == 'failure'
80+
run: exit 1
81+
82+
# https://github.com/marketplace/actions/alls-green#why
83+
pre-commit-alls-green: # This job does nothing and is only used for the branch protection
84+
if: always()
85+
needs:
86+
- pre-commit
87+
runs-on: ubuntu-latest
88+
steps:
89+
- name: Dump GitHub context
90+
env:
91+
GITHUB_CONTEXT: ${{ toJson(github) }}
92+
run: echo "$GITHUB_CONTEXT"
93+
- name: Decide whether the needed jobs succeeded or failed
94+
uses: re-actors/alls-green@release/v1
95+
with:
96+
jobs: ${{ toJSON(needs) }}

.github/workflows/smokeshow.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77

88
jobs:
99
smokeshow:
10-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1110
runs-on: ubuntu-latest
1211
permissions:
1312
actions: read
@@ -17,7 +16,7 @@ jobs:
1716
- uses: actions/checkout@v6
1817
- uses: actions/setup-python@v6
1918
with:
20-
python-version: "3.10"
19+
python-version: "3.13"
2120
- run: pip install smokeshow
2221
- uses: actions/download-artifact@v7
2322
with:

.github/workflows/test-backend.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ jobs:
2121
python-version: "3.10"
2222
- name: Install uv
2323
uses: astral-sh/setup-uv@v7
24-
with:
25-
version: "0.4.15"
26-
enable-cache: true
2724
- run: docker compose down -v --remove-orphans
2825
- run: docker compose up -d db mailcatcher
2926
- name: Migrate DB
@@ -39,3 +36,6 @@ jobs:
3936
name: coverage-html
4037
path: backend/htmlcov
4138
include-hidden-files: true
39+
- name: Coverage report
40+
run: uv run coverage report --fail-under=90
41+
working-directory: backend
File renamed without changes.

.pre-commit-config.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,25 @@ repos:
1717
)$
1818
- id: trailing-whitespace
1919
exclude: ^frontend/src/client/.*
20-
- repo: https://github.com/charliermarsh/ruff-pre-commit
21-
rev: v0.2.2
22-
hooks:
23-
- id: ruff
24-
args:
25-
- --fix
26-
- id: ruff-format
2720
- repo: local
2821
hooks:
2922
- id: local-biome-check
3023
name: biome check
31-
entry: bash -c 'cd frontend && npm run lint'
24+
entry: npm run lint
3225
language: system
3326
types: [text]
3427
files: ^frontend/
3528

36-
ci:
37-
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
38-
autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate
29+
- id: local-ruff-check
30+
name: ruff check
31+
entry: uv run ruff check --force-exclude --fix --exit-non-zero-on-fix
32+
require_serial: true
33+
language: unsupported
34+
types: [python]
35+
36+
- id: local-ruff-format
37+
name: ruff format
38+
entry: uv run ruff format --force-exclude --exit-non-zero-on-format
39+
require_serial: true
40+
language: unsupported
41+
types: [python]

backend/Dockerfile

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@ FROM python:3.10
22

33
ENV PYTHONUNBUFFERED=1
44

5-
WORKDIR /app/
6-
75
# Install uv
86
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
97
COPY --from=ghcr.io/astral-sh/uv:0.5.11 /uv /uvx /bin/
108

11-
# Place executables in the environment at the front of the path
12-
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#using-the-environment
13-
ENV PATH="/app/.venv/bin:$PATH"
14-
159
# Compile bytecode
1610
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode
1711
ENV UV_COMPILE_BYTECODE=1
@@ -20,25 +14,32 @@ ENV UV_COMPILE_BYTECODE=1
2014
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#caching
2115
ENV UV_LINK_MODE=copy
2216

17+
WORKDIR /app/
18+
19+
# Place executables in the environment at the front of the path
20+
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#using-the-environment
21+
ENV PATH="/app/.venv/bin:$PATH"
22+
2323
# Install dependencies
2424
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
2525
RUN --mount=type=cache,target=/root/.cache/uv \
2626
--mount=type=bind,source=uv.lock,target=uv.lock \
2727
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
28-
uv sync --frozen --no-install-project
28+
uv sync --frozen --no-install-workspace --package app
2929

30-
ENV PYTHONPATH=/app
30+
COPY ./backend/scripts /app/backend/scripts
3131

32-
COPY ./scripts /app/scripts
32+
COPY ./backend/pyproject.toml ./backend/alembic.ini /app/backend/
3333

34-
COPY ./pyproject.toml ./uv.lock ./alembic.ini /app/
35-
36-
COPY ./app /app/app
37-
COPY ./tests /app/tests
34+
COPY ./backend/app /app/backend/app
3835

3936
# Sync the project
4037
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
4138
RUN --mount=type=cache,target=/root/.cache/uv \
42-
uv sync
39+
--mount=type=bind,source=uv.lock,target=uv.lock \
40+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
41+
uv sync --frozen --package app
42+
43+
WORKDIR /app/backend/
4344

4445
CMD ["fastapi", "run", "--workers", "4", "app/main.py"]

backend/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ dependencies = [
2323
"pyjwt<3.0.0,>=2.8.0",
2424
]
2525

26-
[tool.uv]
27-
dev-dependencies = [
26+
[dependency-groups]
27+
dev = [
2828
"pytest<8.0.0,>=7.4.3",
2929
"mypy<2.0.0,>=1.8.0",
3030
"ruff<1.0.0,>=0.2.2",
31-
"pre-commit<4.0.0,>=3.6.2",
31+
"prek>=0.2.24,<1.0.0",
3232
"types-passlib<2.0.0.0,>=1.7.7.20240106",
3333
"coverage<8.0.0,>=7.4.3",
3434
]

0 commit comments

Comments
 (0)