Skip to content

Commit d7efe0c

Browse files
authored
Merge branch 'master' into fix-backend-test
2 parents 5e70816 + 86ef743 commit d7efe0c

File tree

122 files changed

+10684
-9179
lines changed

Some content is hidden

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

122 files changed

+10684
-9179
lines changed

.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Domain
22
# This would be set to the production domain with an env var on deployment
3+
# used by Traefik to transmit traffic and aqcuire TLS certificates
34
DOMAIN=localhost
5+
# To test the local Traefik config
6+
# DOMAIN=localhost.tiangolo.com
7+
8+
# Used by the backend to generate links in emails to the frontend
9+
FRONTEND_HOST=http://localhost:5173
10+
# In staging and production, set this env var to the frontend host, e.g.
11+
# FRONTEND_HOST=https://dashboard.example.com
412

513
# Environment: local, staging, production
614
ENVIRONMENT=local

.github/dependabot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
version: 2
22
updates:
33
# GitHub Actions
4-
- package-ecosystem: "github-actions"
5-
directory: "/"
4+
- package-ecosystem: github-actions
5+
directory: /
66
schedule:
7-
interval: "daily"
7+
interval: daily
88
commit-message:
99
prefix:
1010
# Python
11-
- package-ecosystem: "pip"
12-
directory: "/"
11+
- package-ecosystem: pip
12+
directory: /
1313
schedule:
14-
interval: "daily"
14+
interval: daily
1515
commit-message:
1616
prefix:

.github/workflows/generate-client.yml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ jobs:
1212
contents: write
1313
runs-on: ubuntu-latest
1414
steps:
15+
# For PRs from forks
1516
- uses: actions/checkout@v4
17+
# For PRs from the same repo
18+
- uses: actions/checkout@v4
19+
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
1620
with:
1721
ref: ${{ github.head_ref }}
1822
token: ${{ secrets.FULL_STACK_FASTAPI_TEMPLATE_REPO_TOKEN }}
@@ -21,29 +25,37 @@ jobs:
2125
node-version: lts/*
2226
- uses: actions/setup-python@v5
2327
with:
24-
python-version: '3.10'
28+
python-version: "3.10"
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v5
31+
with:
32+
version: "0.4.15"
33+
enable-cache: true
2534
- name: Install dependencies
2635
run: npm ci
2736
working-directory: frontend
28-
- run: pip install ./backend
29-
- run: bash scripts/generate-client.sh
30-
- name: Commit changes
37+
- run: uv sync
38+
working-directory: backend
39+
- run: uv run bash scripts/generate-client.sh
40+
env:
41+
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
46+
- name: Add changes to git
3147
run: |
3248
git config --local user.email "github-actions@github.com"
3349
git config --local user.name "github-actions"
3450
git add frontend/src/client
51+
# Same repo PRs
52+
- name: Push changes
53+
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
54+
run: |
3555
git diff --staged --quiet || git commit -m "✨ Autogenerate frontend client"
3656
git push
37-
38-
# https://github.com/marketplace/actions/alls-green#why
39-
generate-client-alls-green: # This job does nothing and is only used for the branch protection
40-
if: always()
41-
needs:
42-
- generate-client
43-
runs-on: ubuntu-latest
44-
steps:
45-
- name: Decide whether the needed jobs succeeded or failed
46-
uses: re-actors/alls-green@release/v1
47-
with:
48-
jobs: ${{ toJSON(needs) }}
49-
57+
# Fork PRs
58+
- name: Check changes
59+
if: ( github.event_name == 'pull_request' && github.secret_source != 'Actions' )
60+
run: |
61+
git diff --staged --quiet || (echo "Changes detected in generated client, run scripts/generate-client.sh and commit the changes" && exit 1)

.github/workflows/issue-manager.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Issue Manager
22

33
on:
44
schedule:
5-
- cron: "13 4 * * *"
5+
- cron: "21 17 * * *"
66
issue_comment:
77
types:
88
- created
@@ -16,6 +16,7 @@ on:
1616

1717
permissions:
1818
issues: write
19+
pull-requests: write
1920

2021
jobs:
2122
issue-manager:
@@ -26,7 +27,7 @@ jobs:
2627
env:
2728
GITHUB_CONTEXT: ${{ toJson(github) }}
2829
run: echo "$GITHUB_CONTEXT"
29-
- uses: tiangolo/issue-manager@0.5.0
30+
- uses: tiangolo/issue-manager@0.5.1
3031
with:
3132
token: ${{ secrets.GITHUB_TOKEN }}
3233
config: >
@@ -35,8 +36,12 @@ jobs:
3536
"delay": 864000,
3637
"message": "Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs."
3738
},
38-
"changes-requested": {
39+
"waiting": {
3940
"delay": 2628000,
40-
"message": "As this PR had requested changes to be applied but has been inactive for a while, it's now going to be closed. But if there's anyone interested, feel free to create a new PR."
41+
"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."
4146
}
4247
}

.github/workflows/labeler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/labeler@v5
20+
if: ${{ github.event.action != 'labeled' && github.event.action != 'unlabeled' }}
21+
- run: echo "Done adding labels"
2022
# Run this after labeler applied labels
2123
check-labels:
2224
needs:

.github/workflows/latest-changes.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ on:
1212
description: PR number
1313
required: true
1414
debug_enabled:
15-
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
15+
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
1616
required: false
17-
default: 'false'
17+
default: "false"
1818

1919
jobs:
2020
latest-changes:
@@ -30,11 +30,11 @@ jobs:
3030
with:
3131
# To allow latest-changes to commit to the main branch
3232
token: ${{ secrets.LATEST_CHANGES }}
33-
- uses: tiangolo/latest-changes@0.3.1
33+
- uses: tiangolo/latest-changes@0.3.2
3434
with:
3535
token: ${{ secrets.GITHUB_TOKEN }}
3636
latest_changes_file: ./release-notes.md
37-
latest_changes_header: '## Latest Changes'
38-
end_regex: '^## '
37+
latest_changes_header: "## Latest Changes"
38+
end_regex: "^## "
3939
debug_logs: true
40-
label_header_prefix: '### '
40+
label_header_prefix: "### "

.github/workflows/lint-backend.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Lint Backend
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
12+
jobs:
13+
lint-backend:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.10"
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v5
24+
with:
25+
version: "0.4.15"
26+
enable-cache: true
27+
- run: uv run bash scripts/lint.sh
28+
working-directory: backend

.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
4576
- name: Run Playwright tests
46-
run: npx playwright test
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/smokeshow.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Smokeshow
22

33
on:
44
workflow_run:
5-
workflows: [Test]
5+
workflows: [Test Backend]
66
types: [completed]
77

88
jobs:
@@ -14,19 +14,17 @@ jobs:
1414
statuses: write
1515

1616
steps:
17+
- uses: actions/checkout@v4
1718
- uses: actions/setup-python@v5
1819
with:
19-
python-version: '3.9'
20-
20+
python-version: "3.10"
2121
- run: pip install smokeshow
22-
2322
- uses: actions/download-artifact@v4
2423
with:
2524
name: coverage-html
2625
path: backend/htmlcov
2726
github-token: ${{ secrets.GITHUB_TOKEN }}
2827
run-id: ${{ github.event.workflow_run.id }}
29-
3028
- run: smokeshow upload backend/htmlcov
3129
env:
3230
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}

0 commit comments

Comments
 (0)