ci: add GitHub Actions workflow for dashboard tests

- Backend: pytest on web_dashboard/backend/tests/
- Frontend: npm ci + lint on push/PR to dashboard paths
- Triggers on main, feat/**, fix/** branches

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
陈少杰 2026-04-07 19:04:11 +08:00
parent 3e2a398c5a
commit 6eb12ba720
1 changed files with 53 additions and 0 deletions

53
.github/workflows/dashboard-tests.yml vendored Normal file
View File

@ -0,0 +1,53 @@
name: Dashboard Tests
on:
push:
branches: [main, feat/**, fix/**]
paths:
- 'web_dashboard/backend/**/*.py'
- 'web_dashboard/frontend/**/*.js'
- '.github/workflows/dashboard-tests.yml'
pull_request:
paths:
- 'web_dashboard/backend/**/*.py'
- 'web_dashboard/frontend/**/*.js'
jobs:
test-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio httpx
pip install -e . 2>/dev/null || true
- name: Run backend tests
working-directory: web_dashboard/backend
run: |
python -m pytest tests/ -v --tb=short
test-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
working-directory: web_dashboard/frontend
run: npm ci
- name: Lint
working-directory: web_dashboard/frontend
run: npm run lint 2>/dev/null || true