Files
nas-tools/.gitea/workflows/test.yml
T
Gan, Jimmy a7fa54476d
Run Tests / Backend Tests (push) Failing after 4m46s
Run Tests / Frontend Tests (push) Failing after 4m27s
Run Tests / Test Summary (push) Failing after 39s
debug: check workspace contents
2026-04-04 15:03:40 +08:00

84 lines
2.1 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: Debug workspace
run: |
pwd
ls -la
find . -name "dashboard" -type d 2>/dev/null || echo "dashboard not found"
- name: Install Python
run: |
apt-get update && apt-get install -y python3 python3-pip python3-venv
- name: Install dependencies
run: |
cd dashboard/backend
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
pip3 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
steps:
- name: Install Node.js
run: |
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
- 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"