Files
nas-tools/.gitea/workflows/test.yml
T
Gan, Jimmy 585a4c0500
Deploy Claude Dev (Dev) / deploy-claude-dev-dev (push) Failing after 11m14s
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 14m4s
Run Tests / Backend Tests (push) Failing after 16m38s
Run Tests / Test Summary (push) Has been cancelled
Run Tests / Frontend Tests (push) Has started running
ci: enforce strict v8 memory and thread limit to prevent CI from crashing the NAS kernel
2026-04-05 00:39:46 +08:00

94 lines
2.4 KiB
YAML

name: Run Tests
on:
push:
branches: [main, dev]
pull_request:
branches: [main]
jobs:
backend-tests:
name: Backend Tests
runs-on: ubuntu-latest
env:
SECRET_KEY: test-secret-key-for-ci-environment-32chars-minimum
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: 'dashboard/backend/requirements*.txt'
- name: Install dependencies
run: |
cd dashboard/backend
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install pytest-timeout
- name: Run unit tests
run: |
cd dashboard/backend
. venv/bin/activate
pytest tests/unit/ -v --timeout=30 -x
- name: Run integration tests
run: |
cd dashboard/backend
. venv/bin/activate
pytest tests/integration/ -v --timeout=30 -x
frontend-tests:
name: Frontend Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'dashboard/frontend/package-lock.json'
- name: Install dependencies
env:
NODE_OPTIONS: "--max-old-space-size=2048"
run: |
cd dashboard/frontend
npm ci
- name: Run tests
env:
NODE_OPTIONS: "--max-old-space-size=2048"
run: |
cd dashboard/frontend
npm run test:coverage -- --reporter=verbose --run --pool=forks --poolOptions.forks.maxForks=2
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [backend-tests, frontend-tests]
if: always()
steps:
- name: Check job results
run: |
echo "Backend tests: ${{ needs.backend-tests.result }}"
echo "Frontend tests: ${{ needs.frontend-tests.result }}"
if [ "${{ needs.backend-tests.result }}" != "success" ] || [ "${{ needs.frontend-tests.result }}" != "success" ]; then
echo "❌ Some tests failed"
exit 1
fi
echo "✅ All tests passed"