Repository navigation
79 lines (75 loc) · 2.65 KB
/
Copy pathfastapi-react.yml
File metadata and controls
79 lines (75 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: FastAPI + React parity checks
permissions:
contents: read
on:
pull_request:
paths:
- "fastapi_react/**"
- ".github/workflows/fastapi-react.yml"
push:
branches: [main, "design/fastapi-react"]
paths:
- "fastapi_react/**"
workflow_dispatch:
jobs:
backend:
name: Backend (ruff, mypy, pytest)
runs-on: ubuntu-latest
defaults:
run:
working-directory: fastapi_react/backend
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
fastapi_react/backend/requirements.txt
fastapi_react/backend/requirements-dev.txt
- name: Install runtime + dev requirements
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- name: Ruff
run: python -m ruff check .
- name: Mypy (strict)
run: python -m mypy --explicit-package-bases app
- name: Pytest with coverage (>=80%)
run: python -m pytest
- name: pip-audit
run: python -m pip_audit -r requirements.txt
continue-on-error: true # known dev-dep advisories; see PARITY_REPORT.md
frontend:
name: Frontend (eslint, tsc, vitest, build, audit)
runs-on: ubuntu-latest
defaults:
run:
working-directory: fastapi_react/frontend
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version: "20"
cache: npm
cache-dependency-path: fastapi_react/frontend/package-lock.json
- name: Install
run: npm ci
- name: ESLint
run: npm run lint
- name: Type check
run: npx tsc --noEmit
- name: Vitest with coverage
run: npm test
- name: Build (bundle size budget)
run: npm run build
- name: Check production HTTP caching
run: |
docker run -d --name f1-nginx-check --add-host backend:127.0.0.1 -p 8080:80 -v "$PWD/dist:/usr/share/nginx/html:ro" -v "$PWD/nginx.conf:/etc/nginx/conf.d/default.conf:ro" nginx:1.27-alpine
for attempt in {1..20}; do curl --silent --fail http://127.0.0.1:8080/index.html >/dev/null && break; sleep 1; done
npm run check:hosting
- name: Stop caching check container
if: always()
run: docker rm -f f1-nginx-check || true
- name: Production-deps audit
run: npm audit --omit=dev