Files
nas-tools/.gitea/workflows/test.yml
T
Gan, Jimmy 8629f594a3
Run Tests / Backend Tests (push) Failing after 2m41s
Run Tests / Frontend Tests (push) Failing after 10m8s
Run Tests / Test Summary (push) Has been cancelled
debug: check workspace contents in test workflow
2026-04-04 14:11:56 +08:00

79 lines
1.9 KiB
YAML

name: Run Tests
on:
push:
branches: [main, dev]
pull_request:
branches: [main]
jobs:
backend-tests:
name: Backend Tests
runs-on: ubuntu-latest
container:
image: python:3.12-slim
env:
SECRET_KEY: test-secret-key-for-ci-environment-32chars-minimum
steps:
- name: Check workspace
run: |
pwd
ls -la
ls -la dashboard/ || echo "dashboard directory not found"
- name: Install dependencies
run: |
cd dashboard/backend
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install pytest-timeout
- name: Run unit tests
run: |
cd dashboard/backend
pytest tests/unit/ -v --timeout=30 -x
echo "✅ Unit tests passed"
- name: Run integration tests
run: |
cd dashboard/backend
pytest tests/integration/ -v --timeout=30 -x
echo "✅ Integration tests passed"
frontend-tests:
name: Frontend Tests
runs-on: ubuntu-latest
container:
image: node:20-slim
steps:
- name: Install dependencies
run: |
cd dashboard/frontend
npm ci
- name: Run tests
run: |
cd dashboard/frontend
npm run test:coverage -- --reporter=verbose --run
echo "✅ Frontend tests passed"
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"