Refactoring and testing #19
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Tests | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| workflow_dispatch: | |
| jobs: | |
| e2e: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: postgres | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| redis: | |
| image: redis:8 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install backend dependencies | |
| working-directory: backend | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Install frontend dependencies | |
| working-directory: web | |
| run: npm ci | |
| - name: Install Playwright | |
| run: npx playwright install --with-deps | |
| - name: Run database migrations | |
| working-directory: backend | |
| run: | | |
| alembic upgrade head | |
| env: | |
| DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/postgres | |
| - name: Start backend | |
| working-directory: backend | |
| run: | | |
| uvicorn main:app --host 0.0.0.0 --port 8000 & | |
| env: | |
| DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/postgres | |
| REDIS_URL: redis://localhost:6379 | |
| ISSUER_URI: http://localhost:8080/realms/tasks | |
| PUBLIC_ISSUER_URI: http://localhost:8080/realms/tasks | |
| CLIENT_ID: tasks-backend | |
| CLIENT_SECRET: tasks-secret | |
| ENV: test | |
| - name: Build frontend | |
| working-directory: web | |
| run: npm run build | |
| - name: Start frontend | |
| working-directory: web | |
| run: | | |
| npm start & | |
| env: | |
| NEXT_PUBLIC_API_URL: http://localhost:8000/graphql | |
| - name: Wait for backend | |
| run: | | |
| echo "Waiting for backend to start..." | |
| timeout 120 bash -c 'until curl -f -s http://localhost:8000/health > /dev/null 2>&1; do sleep 2; done' | |
| echo "Backend is ready!" | |
| - name: Wait for frontend | |
| run: | | |
| echo "Waiting for frontend to start..." | |
| timeout 120 bash -c 'until curl -f -s http://localhost:3000 > /dev/null 2>&1; do sleep 2; done' | |
| echo "Frontend is ready!" | |
| - name: Run E2E tests | |
| run: | | |
| npx playwright test | |
| env: | |
| E2E_BASE_URL: http://localhost:3000 | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 30 | |