Skip to content

Commit 165e250

Browse files
authored
Merge branch 'master' into backend-read-user-by-id-no-user
2 parents 03eb016 + 6efd3ba commit 165e250

File tree

103 files changed

+8389
-6662
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+8389
-6662
lines changed

.github/workflows/generate-client.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
with:
2828
python-version: "3.10"
2929
- name: Install uv
30-
uses: astral-sh/setup-uv@v3
30+
uses: astral-sh/setup-uv@v5
3131
with:
3232
version: "0.4.15"
3333
enable-cache: true
@@ -39,6 +39,10 @@ jobs:
3939
- run: uv run bash scripts/generate-client.sh
4040
env:
4141
VIRTUAL_ENV: backend/.venv
42+
ENVIRONMENT: production
43+
SECRET_KEY: just-for-generating-client
44+
POSTGRES_PASSWORD: just-for-generating-client
45+
FIRST_SUPERUSER_PASSWORD: just-for-generating-client
4246
- name: Add changes to git
4347
run: |
4448
git config --local user.email "[email protected]"

.github/workflows/issue-manager.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,9 @@ jobs:
3939
"waiting": {
4040
"delay": 2628000,
4141
"message": "As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR."
42+
},
43+
"invalid": {
44+
"delay": 0,
45+
"message": "This was marked as invalid and will be closed now. If this is an error, please provide additional details."
4246
}
4347
}

.github/workflows/latest-changes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
# To allow latest-changes to commit to the main branch
3232
token: ${{ secrets.LATEST_CHANGES }}
33-
- uses: tiangolo/[email protected].1
33+
- uses: tiangolo/[email protected].2
3434
with:
3535
token: ${{ secrets.GITHUB_TOKEN }}
3636
latest_changes_file: ./release-notes.md

.github/workflows/lint-backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
python-version: "3.10"
2222
- name: Install uv
23-
uses: astral-sh/setup-uv@v3
23+
uses: astral-sh/setup-uv@v5
2424
with:
2525
version: "0.4.15"
2626
enable-cache: true

.github/workflows/playwright.yml

Lines changed: 79 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,36 @@ on:
1616
default: 'false'
1717

1818
jobs:
19+
changes:
20+
runs-on: ubuntu-latest
21+
# Set job outputs to values from filter step
22+
outputs:
23+
changed: ${{ steps.filter.outputs.changed }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
# For pull requests it's not necessary to checkout the code but for the main branch it is
27+
- uses: dorny/paths-filter@v3
28+
id: filter
29+
with:
30+
filters: |
31+
changed:
32+
- backend/**
33+
- frontend/**
34+
- .env
35+
- docker-compose*.yml
36+
- .github/workflows/playwright.yml
1937
20-
test:
38+
test-playwright:
39+
needs:
40+
- changes
41+
if: ${{ needs.changes.outputs.changed == 'true' }}
2142
timeout-minutes: 60
2243
runs-on: ubuntu-latest
44+
strategy:
45+
matrix:
46+
shardIndex: [1, 2, 3, 4]
47+
shardTotal: [4]
48+
fail-fast: false
2349
steps:
2450
- uses: actions/checkout@v4
2551
- uses: actions/setup-node@v4
@@ -33,35 +59,73 @@ jobs:
3359
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
3460
with:
3561
limit-access-to-actor: true
36-
- name: Install dependencies
37-
run: npm ci
38-
working-directory: frontend
39-
- name: Install Playwright Browsers
40-
run: npx playwright install --with-deps
62+
- name: Install uv
63+
uses: astral-sh/setup-uv@v5
64+
with:
65+
version: "0.4.15"
66+
enable-cache: true
67+
- run: uv sync
68+
working-directory: backend
69+
- run: npm ci
4170
working-directory: frontend
71+
- run: uv run bash scripts/generate-client.sh
72+
env:
73+
VIRTUAL_ENV: backend/.venv
4274
- run: docker compose build
4375
- run: docker compose down -v --remove-orphans
44-
- run: docker compose up -d --wait backend mailcatcher
4576
- name: Run Playwright tests
46-
run: npx playwright test --fail-on-flaky-tests --trace=retain-on-failure
47-
working-directory: frontend
77+
run: docker compose run --rm playwright npx playwright test --fail-on-flaky-tests --trace=retain-on-failure --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
4878
- run: docker compose down -v --remove-orphans
49-
- uses: actions/upload-artifact@v4
50-
if: always()
79+
- name: Upload blob report to GitHub Actions Artifacts
80+
if: ${{ !cancelled() }}
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: blob-report-${{ matrix.shardIndex }}
84+
path: frontend/blob-report
85+
include-hidden-files: true
86+
retention-days: 1
87+
88+
merge-playwright-reports:
89+
needs:
90+
- test-playwright
91+
- changes
92+
# Merge reports after playwright-tests, even if some shards have failed
93+
if: ${{ !cancelled() && needs.changes.outputs.changed == 'true' }}
94+
runs-on: ubuntu-latest
95+
steps:
96+
- uses: actions/checkout@v4
97+
- uses: actions/setup-node@v4
98+
with:
99+
node-version: 20
100+
- name: Install dependencies
101+
run: npm ci
102+
working-directory: frontend
103+
- name: Download blob reports from GitHub Actions Artifacts
104+
uses: actions/download-artifact@v4
105+
with:
106+
path: frontend/all-blob-reports
107+
pattern: blob-report-*
108+
merge-multiple: true
109+
- name: Merge into HTML Report
110+
run: npx playwright merge-reports --reporter html ./all-blob-reports
111+
working-directory: frontend
112+
- name: Upload HTML report
113+
uses: actions/upload-artifact@v4
51114
with:
52-
name: playwright-report
53-
path: frontend/playwright-report/
115+
name: html-report--attempt-${{ github.run_attempt }}
116+
path: frontend/playwright-report
54117
retention-days: 30
55118
include-hidden-files: true
56119

57120
# https://github.com/marketplace/actions/alls-green#why
58-
e2e-alls-green: # This job does nothing and is only used for the branch protection
121+
alls-green-playwright: # This job does nothing and is only used for the branch protection
59122
if: always()
60123
needs:
61-
- test
124+
- test-playwright
62125
runs-on: ubuntu-latest
63126
steps:
64127
- name: Decide whether the needed jobs succeeded or failed
65128
uses: re-actors/alls-green@release/v1
66129
with:
67130
jobs: ${{ toJSON(needs) }}
131+
allowed-skips: test-playwright

.github/workflows/test-backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
python-version: "3.10"
2222
- name: Install uv
23-
uses: astral-sh/setup-uv@v3
23+
uses: astral-sh/setup-uv@v5
2424
with:
2525
version: "0.4.15"
2626
enable-cache: true

.github/workflows/test-docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@v4
1919
- run: docker compose build
2020
- run: docker compose down -v --remove-orphans
21-
- run: docker compose up -d --wait
21+
- run: docker compose up -d --wait backend frontend adminer
2222
- name: Test backend is up
2323
run: curl http://localhost:8000/api/v1/utils/health-check
2424
- name: Test frontend is up

backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ WORKDIR /app/
66

77
# Install uv
88
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
9-
COPY --from=ghcr.io/astral-sh/uv:0.4.15 /uv /bin/uv
9+
COPY --from=ghcr.io/astral-sh/uv:0.5.11 /uv /uvx /bin/
1010

1111
# Place executables in the environment at the front of the path
1212
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#using-the-environment

backend/app/api/main.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
from fastapi import APIRouter
22

3-
from app.api.routes import items, login, users, utils
3+
from app.api.routes import items, login, private, users, utils
4+
from app.core.config import settings
45

56
api_router = APIRouter()
6-
api_router.include_router(login.router, tags=["login"])
7-
api_router.include_router(users.router, prefix="/users", tags=["users"])
8-
api_router.include_router(utils.router, prefix="/utils", tags=["utils"])
9-
api_router.include_router(items.router, prefix="/items", tags=["items"])
7+
api_router.include_router(login.router)
8+
api_router.include_router(users.router)
9+
api_router.include_router(utils.router)
10+
api_router.include_router(items.router)
11+
12+
13+
if settings.ENVIRONMENT == "local":
14+
api_router.include_router(private.router)

backend/app/api/routes/items.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from app.api.deps import CurrentUser, SessionDep
88
from app.models import Item, ItemCreate, ItemPublic, ItemsPublic, ItemUpdate, Message
99

10-
router = APIRouter()
10+
router = APIRouter(prefix="/items", tags=["items"])
1111

1212

1313
@router.get("/", response_model=ItemsPublic)

0 commit comments

Comments
 (0)