From d9db22b1af788978b44b4e248304a3a74477e992 Mon Sep 17 00:00:00 2001 From: Shaojie <73728610+Shaojie66@users.noreply.github.com> Date: Tue, 7 Apr 2026 19:12:39 +0800 Subject: [PATCH] ci: add GitHub Actions workflow for dashboard tests (#5) - 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 --- .github/workflows/dashboard-tests.yml | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/dashboard-tests.yml diff --git a/.github/workflows/dashboard-tests.yml b/.github/workflows/dashboard-tests.yml new file mode 100644 index 00000000..0bdf0fe1 --- /dev/null +++ b/.github/workflows/dashboard-tests.yml @@ -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