fix: TypeScript build errors #122
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 | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| backend-lint: | |
| name: Backend Lint | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: backend | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Lint with ruff | |
| run: uv run ruff check . | |
| - name: Type check with mypy | |
| run: uv run mypy app --ignore-missing-imports | |
| backend-test: | |
| name: Backend Test | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: backend | |
| services: | |
| postgres: | |
| image: pgvector/pgvector:pg16 | |
| env: | |
| POSTGRES_USER: familiar | |
| POSTGRES_PASSWORD: familiar | |
| POSTGRES_DB: familiar | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Initialize database | |
| env: | |
| DATABASE_URL: postgresql+asyncpg://familiar:familiar@localhost:5432/familiar | |
| run: uv run python -m app.db.init_db | |
| - name: Run tests | |
| env: | |
| DATABASE_URL: postgresql+asyncpg://familiar:familiar@localhost:5432/familiar | |
| REDIS_URL: redis://localhost:6379/0 | |
| run: uv run pytest -v --tb=short | |
| frontend-lint: | |
| name: Frontend Lint | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| 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 | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| frontend-build: | |
| name: Frontend Build | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| 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 | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-dist | |
| path: frontend/dist | |
| retention-days: 7 | |
| docker-build: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| needs: [backend-lint, frontend-lint] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: docker/Dockerfile | |
| push: false | |
| tags: familiar:test | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| e2e-test: | |
| name: E2E Tests (Playwright) | |
| runs-on: ubuntu-latest | |
| needs: [docker-build] | |
| services: | |
| postgres: | |
| image: pgvector/pgvector:pg16 | |
| env: | |
| POSTGRES_USER: familiar | |
| POSTGRES_PASSWORD: familiar | |
| POSTGRES_DB: familiar | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install backend dependencies | |
| working-directory: backend | |
| run: uv sync --all-extras | |
| - name: Initialize database | |
| working-directory: backend | |
| env: | |
| DATABASE_URL: postgresql+asyncpg://familiar:familiar@localhost:5432/familiar | |
| run: uv run python -m app.db.init_db | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Build frontend for E2E tests | |
| working-directory: frontend | |
| run: | | |
| npm run build | |
| mkdir -p ../backend/static | |
| cp -r dist/* ../backend/static/ | |
| - name: Start backend server | |
| working-directory: backend | |
| env: | |
| DATABASE_URL: postgresql+asyncpg://familiar:familiar@localhost:5432/familiar | |
| REDIS_URL: redis://localhost:6379/0 | |
| run: | | |
| uv run uvicorn app.main:app --host 0.0.0.0 --port 4400 & | |
| sleep 10 | |
| - name: Install Playwright browsers | |
| working-directory: frontend | |
| run: npx playwright install --with-deps chromium | |
| - name: Run Playwright tests | |
| working-directory: frontend | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }} | |
| SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }} | |
| LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }} | |
| LASTFM_API_SECRET: ${{ secrets.LASTFM_API_SECRET }} | |
| run: npm run test:e2e | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: frontend/playwright-report/ | |
| retention-days: 7 |