diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4b7dc04..6d1660df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,9 +56,13 @@ jobs: run: pnpm test:unit run e2e: - timeout-minutes: 60 - # Playwright 1.60 can't install browsers on ubuntu-latest (26.04) yet. + name: e2e (${{ matrix.project }}) + timeout-minutes: 30 runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + project: [chromium, firefox, webkit] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -77,17 +81,31 @@ jobs: ${{ runner.os }}-pnpm-store- - name: Install dependencies run: pnpm install - - name: Install Playwright Browsers - run: pnpm exec playwright install --with-deps + # The browsers match whatever @playwright/test pnpm-lock.yaml resolves. + - name: Get Playwright version + shell: bash + run: echo "PLAYWRIGHT_VERSION=$(pnpm exec playwright --version | awk '{print $2}')" >> $GITHUB_ENV + - uses: actions/cache@v4 + id: playwright-cache + with: + path: ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}-${{ matrix.project }} + - name: Install Playwright browser + if: steps.playwright-cache.outputs.cache-hit != 'true' + run: pnpm exec playwright install --with-deps ${{ matrix.project }} + # System libraries live outside the cache. + - name: Install Playwright system dependencies + if: steps.playwright-cache.outputs.cache-hit == 'true' + run: pnpm exec playwright install-deps ${{ matrix.project }} - name: Run Playwright tests - run: pnpm exec playwright test + run: pnpm exec playwright test --project=${{ matrix.project }} env: ASTRO_DB_REMOTE_URL: ${{ secrets.ASTRO_DB_REMOTE_URL }} ASTRO_DB_APP_TOKEN: ${{ secrets.ASTRO_DB_APP_TOKEN }} - uses: actions/upload-artifact@v4 if: always() with: - name: playwright-report + name: playwright-report-${{ matrix.project }} path: playwright-report/ retention-days: 30 diff --git a/.gitignore b/.gitignore index 7fdd9ceb..9a4cf358 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ test-results/ # macOS-specific files .DS_Store package-lock.json + +# Impeccable hook cache +packages/starpod/.impeccable/hook.cache.json diff --git a/CLAUDE.md b/CLAUDE.md index 4ddd7fa5..cbb01454 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -13,24 +13,34 @@ Whatnot podcast). ## Commands - **Dev server:** `pnpm dev` (runs on localhost:4321) -- **Build:** `pnpm build` (runs `astro check`, `astro build`, then - `scripts/vercel-md-negotiation.mjs`, which injects `Accept: text/markdown` - content-negotiation routes into the Vercel build output) +- **Build:** `pnpm build` (runs `astro check` and `astro build`; the + integration's `astro:build:done` hook then runs + `packages/starpod/src/vercel-md-negotiation.mjs`, which injects + `Accept: text/markdown` content-negotiation routes into the Vercel build + output) - **Lint:** `pnpm lint` (ESLint with caching) - **Lint fix:** `pnpm lint:fix` - **All tests:** `pnpm test` (runs unit + e2e concurrently) - **Unit tests only:** `pnpm test:unit` (Vitest) -- **Single unit test:** `pnpm exec vitest run tests/unit/Player.test.tsx` +- **Single unit test:** `pnpm exec vitest run tests/unit/Island.test.tsx` - **E2E tests only:** `pnpm test:e2e` (Playwright, auto-starts dev server) +- **E2E on another port:** `E2E_PORT=4340 pnpm test:e2e` (default 4321, where + outside CI Playwright reuses whatever server is running; use a free port in a worktree) - **Seed remote DB:** `pnpm db:seed` - **Push schema to DB:** `pnpm db:push` - **Drizzle Studio:** `pnpm db:studio` ## Architecture +Starpod ships as the `starpod` Astro integration in `packages/starpod/`. The +repo root is the whiskey.fm reference site that consumes it: its config files, +`db/seed.ts` and `db/data/`, and a `src/` holding only the sponsor page, +images and transcripts. Below, `src/...` means `packages/starpod/src/...` +unless it says the site's `src/`. + ### Framework Stack -- **Astro 5** with static output, deployed to Vercel +- **Astro 6** with static output, deployed to Vercel - **Preact** for interactive components (player, search, contact form) - **Tailwind CSS v4** via Vite plugin - **Drizzle ORM** with Turso/libSQL for episode guests and sponsors @@ -49,10 +59,13 @@ Whatnot podcast). ### Data Flow Episodes are fetched from the RSS feed at build time via `src/lib/rss.ts`. +Each episode's hosts and guests come from the database where it lists the +episode, else from the feed's `` tags (`src/lib/people.ts`); +with neither, the pieces that show people leave themselves out. Guest/sponsor data lives in `db/data/` as TypeScript files and is seeded to -Turso via `db/seed.ts`. The DB schema is in `db/schema.ts` (Drizzle ORM) with -tables: Episode, Person, HostOrGuest, Sponsor, SponsorForEpisode. The DB -connection is configured in `db/index.ts`. +Turso via `db/seed.ts`. The DB schema is in `src/db/schema.ts` (Drizzle ORM) +with tables: Episode, Person, HostOrGuest, Sponsor, SponsorForEpisode. The DB +connection is configured in `src/db/index.ts`. ### Source Structure @@ -64,23 +77,59 @@ connection is configured in `db/index.ts`. `Accept: text/markdown` clients, and the styled 404 page otherwise. API routes return structured JSON errors via `src/lib/api-errors.ts`. - `src/components/` — Mix of `.astro` (static) and `.tsx` (Preact interactive) - components. The audio player (`src/components/player/`) and search dialog are - Preact. -- `src/components/state.ts` — Preact signals for shared player state. + components. The media player (`src/components/media/`) and search dialog are + Preact. `src/components/explorer/` is the home page's episode explorer. +- `src/components/state.ts` — Preact signals for shared player state + (current episode, Watch/Listen preference, playback readouts). +- `src/components/media/engine.ts` — one persistent `