Changes for 1.2.x #71
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 | |
| # trigger on pushes and PRs targeting only main | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| # Show concise summary of changes | |
| - name: Show Changed Files Summary | |
| run: | | |
| echo "📋 Files Changed in This PR/Push:" | |
| echo "==================================" | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| git diff --name-status ${{ github.event.pull_request.base.sha }}..${{ github.sha }} | head -20 | |
| TOTAL_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.sha }} | wc -l) | |
| else | |
| git diff --name-status HEAD~1..HEAD | head -20 | |
| TOTAL_FILES=$(git diff --name-only HEAD~1..HEAD | wc -l) | |
| fi | |
| echo "==================================" | |
| echo "📊 Total files changed: $TOTAL_FILES" | |
| if [ $TOTAL_FILES -gt 20 ]; then | |
| echo "⚠️ Showing first 20 files only" | |
| fi | |
| # Setup environments | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| # Install dependencies | |
| - name: Install backend dependencies | |
| working-directory: backend | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci --legacy-peer-deps | |
| # Generate Prisma client | |
| - name: Generate Prisma client | |
| working-directory: frontend | |
| env: | |
| DATABASE_URL: "postgresql://dummy:dummy@localhost:5432/dummy" | |
| run: npx prisma generate | |
| # Run fast pre-commit hooks (no frontend linting) | |
| - name: Run pre-commit hooks (fast) | |
| uses: pre-commit/action@v3.0.1 | |
| with: | |
| extra_args: --show-diff-on-failure | |
| # Frontend linting (separate step for speed) | |
| - name: Frontend lint check | |
| working-directory: frontend | |
| run: npm run lint | |
| # Build check | |
| - name: Build Check | |
| working-directory: frontend | |
| env: | |
| DATABASE_URL: "postgresql://dummy:dummy@localhost:5432/dummy" | |
| NEXTAUTH_SECRET: "dummy-secret-for-build" | |
| NEXTAUTH_URL: "http://localhost:3000" | |
| run: npm run build | |
| # Tests | |
| - name: Run backend tests | |
| working-directory: backend | |
| env: | |
| OPENAI_API_KEY: test | |
| DATABASE_URL: postgresql://dummy:dummy@localhost:5432/dummy | |
| run: pytest --maxfail=1 --disable-warnings -q --tb=short | |
| - name: Run frontend tests | |
| working-directory: frontend | |
| env: | |
| NEXTAUTH_SECRET: dummy-secret-for-tests | |
| NEXTAUTH_URL: http://localhost:3000 | |
| run: npm test -- --watchAll=false --bail --passWithNoTests --silent | |
| # Summary | |
| - name: CI Summary | |
| if: always() | |
| run: | | |
| echo "🎉 CI Complete - Pre-commit ✅ Lint ✅ Build ✅ Tests ✅" |