feat(playground): Anonymous repository indexing (#125) #81
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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| # Explicit permissions for security (CodeQL requirement) | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Detect which paths changed | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| backend: ${{ steps.filter.outputs.backend }} | |
| frontend: ${{ steps.filter.outputs.frontend }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| backend: | |
| - 'backend/**' | |
| - 'railway.json' | |
| frontend: | |
| - 'frontend/**' | |
| test-backend: | |
| name: Backend Tests | |
| needs: changes | |
| if: ${{ needs.changes.outputs.backend == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| working-directory: ./backend | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-cov httpx | |
| pip install -r requirements.txt | |
| - name: Run tests | |
| working-directory: ./backend | |
| env: | |
| DEBUG: "true" | |
| API_KEY: "test-secret-key" | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} | |
| SUPABASE_JWT_SECRET: ${{ secrets.SUPABASE_JWT_SECRET }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} | |
| PINECONE_INDEX_NAME: "codeintel-test" | |
| run: | | |
| pytest tests/ -v --cov=services --cov-report=term-missing | |
| - name: Check code quality | |
| working-directory: ./backend | |
| run: | | |
| pip install flake8 | |
| flake8 services/ --max-line-length=120 --ignore=E501,W503 || true | |
| test-frontend: | |
| name: Frontend Tests | |
| needs: changes | |
| if: ${{ needs.changes.outputs.frontend == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up 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: Build frontend | |
| working-directory: ./frontend | |
| run: npm run build | |
| - name: Check TypeScript | |
| working-directory: ./frontend | |
| run: npx tsc --noEmit | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'table' | |
| exit-code: '0' | |
| - name: Check for secrets | |
| uses: trufflesecurity/trufflehog@main | |
| continue-on-error: true | |
| with: | |
| path: ./ | |
| base: main | |
| head: HEAD |