Skip to content

Remove test_transmitterimport.py and associated tests for transmitt… #458

Remove test_transmitterimport.py and associated tests for transmitt…

Remove test_transmitterimport.py and associated tests for transmitt… #458

Workflow file for this run

name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
backend-tests:
name: Backend Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Run tests with coverage
working-directory: ./backend
run: |
py.test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: always()
with:
file: ./backend/coverage.xml
flags: backend
fail_ci_if_error: false
frontend-unit-tests:
name: Frontend Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: ./frontend
run: npm ci
- name: Run linter
working-directory: ./frontend
run: npm run lint
- name: Run unit tests
working-directory: ./frontend
run: npm run test:coverage
- name: Upload coverage reports
uses: codecov/codecov-action@v4
if: always()
with:
files: ./frontend/coverage/lcov.info
flags: frontend
fail_ci_if_error: false
- name: Archive coverage results
uses: actions/upload-artifact@v4
if: always()
with:
name: frontend-coverage-report
path: frontend/coverage/
frontend-e2e-tests:
name: Frontend E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- uses: actions/checkout@v4
- name: Free up disk space
run: |
echo "Disk space before cleanup:"
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo apt-get autoremove -y
sudo apt-get clean
echo "Disk space after cleanup:"
df -h
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build backend Docker image
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: ground-station-backend:test
cache-from: type=gha,scope=e2e-test
cache-to: type=gha,mode=max,scope=e2e-test
- name: Start backend container
run: |
docker run -d \
--name ground-station-backend \
-p 7000:7000 \
-v $(pwd)/data:/app/backend/data \
-e GS_BACKEND_HOST=0.0.0.0 \
-e GS_BACKEND_PORT=7000 \
ground-station-backend:test
- name: Wait for backend to be ready
run: |
echo "Waiting for backend to start..."
for i in {1..90}; do
if curl -f http://localhost:7000/api/health 2>/dev/null || curl -f http://localhost:7000/ 2>/dev/null; then
echo "✓ Backend is ready!"
exit 0
fi
if [ $i -eq 90 ]; then
echo "✗ Backend failed to start in time"
docker logs ground-station-backend 2>&1 || echo "Container logs not available"
exit 1
fi
echo " Waiting for backend... ($i/90)"
sleep 1
done
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: ./frontend
run: npm ci
- name: Install Playwright Browsers
working-directory: ./frontend
run: npx playwright install --with-deps chromium
- name: Test backend connectivity
run: |
echo "Testing HTTP endpoint..."
curl -v http://localhost:7000/ || echo "HTTP request failed"
echo "Testing WebSocket upgrade capability..."
curl -v -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: test" http://localhost:7000/ws || echo "WebSocket test failed"
echo "Backend logs:"
docker logs ground-station-backend 2>&1 | tail -50 || echo "Container logs not available"
- name: Run E2E tests
working-directory: ./frontend
run: npx playwright test --config=playwright.config.js --reporter=list,html
env:
CI: true
BASE_URL: http://localhost:7000
- name: Show backend logs
if: always()
run: docker logs ground-station-backend 2>&1 || echo "Container logs not available"
- name: Stop backend container
if: always()
run: |
docker stop ground-station-backend || true
docker rm ground-station-backend || true
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 30
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-test-results
path: frontend/test-results/
retention-days: 30