Presentation #395
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 ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: # Allows manual trigger | |
| jobs: | |
| e2e-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| db: [sqlite, postgres] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| working-directory: ./backend | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements_versioned.txt | |
| - name: Check for AI file changes | |
| id: changes | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| ai_files: | |
| - 'backend/app/ai/**' | |
| - name: Run AI tests | |
| if: steps.changes.outputs.ai_files == 'true' | |
| working-directory: ./backend | |
| env: | |
| TESTING: "true" | |
| ENVIRONMENT: "production" | |
| OPENAI_API_KEY_TEST: ${{ secrets.OPENAI_API_KEY_TEST }} | |
| run: | | |
| pytest -s -m ai --db=${{ matrix.db }} --disable-warnings | |
| - name: Run E2E tests | |
| working-directory: ./backend | |
| env: | |
| TESTING: "true" | |
| ENVIRONMENT: "production" | |
| OPENAI_API_KEY_TEST: ${{ secrets.OPENAI_API_KEY_TEST }} | |
| run: | | |
| pytest -s -m e2e --db=${{ matrix.db }} --disable-warnings | |
| playwright-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install backend dependencies | |
| working-directory: ./backend | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements_versioned.txt | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'yarn' | |
| cache-dependency-path: frontend/yarn.lock | |
| - name: Install frontend dependencies | |
| working-directory: ./frontend | |
| run: yarn install --frozen-lockfile | |
| - name: Install Playwright browsers | |
| working-directory: ./frontend | |
| run: npx playwright install --with-deps chromium | |
| - name: Start backend server | |
| working-directory: ./backend | |
| env: | |
| TESTING: "true" | |
| ENVIRONMENT: "production" | |
| TEST_DATABASE_URL: "sqlite:///db/playwright.db" | |
| run: | | |
| mkdir -p db uploads/files uploads/branding | |
| echo "Running database migrations..." | |
| alembic upgrade head | |
| echo "Migrations complete, starting server..." | |
| python main.py & | |
| echo "Waiting for backend to start..." | |
| timeout 60 bash -c 'until curl -s http://localhost:8000/health > /dev/null 2>&1; do sleep 1; done' | |
| echo "Backend is ready" | |
| - name: Start frontend dev server | |
| working-directory: ./frontend | |
| run: | | |
| yarn dev & | |
| echo "Waiting for frontend to start..." | |
| timeout 60 bash -c 'until curl -s http://localhost:3000 > /dev/null 2>&1; do sleep 1; done' | |
| echo "Frontend is ready" | |
| - name: Warm up application | |
| run: | | |
| echo "Warming up frontend and backend..." | |
| curl -s http://localhost:3000/users/sign-up > /dev/null || true | |
| curl -s http://localhost:8000/api/settings > /dev/null || true | |
| sleep 3 | |
| echo "Warmup complete" | |
| - name: Run Playwright tests | |
| working-directory: ./frontend | |
| env: | |
| OPENAI_API_KEY_TEST: ${{ secrets.OPENAI_API_KEY_TEST }} | |
| run: npx playwright test --workers=2 | |
| - name: Upload Playwright report | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: | | |
| frontend/test-results/ | |
| frontend/tests/config/*.png | |
| retention-days: 7 | |
| # Integration tests - run on main push OR on PRs from the same repo (not forks for security) | |
| integration-data-sources: | |
| if: github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| working-directory: ./backend | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements_versioned.txt | |
| - name: Restore integrations credentials | |
| run: | | |
| echo "$INTEGRATIONS_JSON_B64" | base64 -d > backend/tests/integrations/integrations.json | |
| env: | |
| INTEGRATIONS_JSON_B64: ${{ secrets.INTEGRATIONS_JSON_B64 }} | |
| - name: Run data source integration tests | |
| working-directory: ./backend | |
| env: | |
| TESTING: "true" | |
| ENVIRONMENT: "production" | |
| run: | | |
| pytest -v tests/integrations/ds_clients.py --disable-warnings | |
| integration-llms: | |
| if: github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for LLM-related file changes | |
| id: changes | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| llm_files: | |
| - 'backend/app/ai/**' | |
| - 'backend/app/models/llm*' | |
| - name: Set up Python | |
| if: steps.changes.outputs.llm_files == 'true' | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| if: steps.changes.outputs.llm_files == 'true' | |
| working-directory: ./backend | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements_versioned.txt | |
| - name: Restore integrations credentials | |
| if: steps.changes.outputs.llm_files == 'true' | |
| run: | | |
| echo "$INTEGRATIONS_JSON_B64" | base64 -d > backend/tests/integrations/integrations.json | |
| env: | |
| INTEGRATIONS_JSON_B64: ${{ secrets.INTEGRATIONS_JSON_B64 }} | |
| - name: Run LLM integration tests | |
| if: steps.changes.outputs.llm_files == 'true' | |
| working-directory: ./backend | |
| env: | |
| TESTING: "true" | |
| ENVIRONMENT: "production" | |
| run: | | |
| pytest -v tests/integrations/llm_clients.py --disable-warnings | |
| dispatch-build: | |
| if: github.ref == 'refs/heads/main' | |
| needs: [e2e-tests, playwright-tests, integration-data-sources, integration-llms] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Trigger Docker build workflow | |
| uses: peter-evans/repository-dispatch@v2 | |
| with: | |
| token: ${{ secrets.PAT_TOKEN }} | |
| event-type: e2e-tests-passed |