From b6d92c260c07dde1b781f2fed33b654f7ed7a93b Mon Sep 17 00:00:00 2001 From: Eduard Abliazimov Date: Sun, 4 Oct 2026 13:43:16 +0200 Subject: [PATCH] Add CI and GitHub Pages deploy workflows CI runs typecheck, unit tests, and the Playwright e2e suite on every push and PR. Deploy builds the web app with a GitHub Pages base path and publishes it via actions/deploy-pages on push to main. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci.yml | 41 +++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 51 ++++++++++++++++++++++++++++++++++++ apps/web/vite.config.ts | 2 ++ docs/STATUS.md | 6 ++--- 4 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..736fa9d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - run: pnpm install --frozen-lockfile + + - run: pnpm typecheck + + - run: pnpm test + + - run: pnpm build + + - name: Install Playwright browsers + run: pnpm --filter @vicoding/web exec playwright install --with-deps chromium + + - name: Run e2e tests + run: pnpm --filter @vicoding/web e2e + + - name: Upload Playwright report + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: apps/web/playwright-report/ + retention-days: 7 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..5160c9d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,51 @@ +name: Deploy web app to GitHub Pages + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - run: pnpm install --frozen-lockfile + + - name: Build web app + env: + VITE_BASE: /${{ github.event.repository.name }}/ + run: pnpm build + + - uses: actions/configure-pages@v5 + + - uses: actions/upload-pages-artifact@v3 + with: + path: apps/web/dist + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index d214225..1e51ff6 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -47,6 +47,8 @@ function pyodideAssets(): Plugin { } export default defineConfig({ + // Set by the GitHub Pages deploy workflow so assets resolve under //; "/" for local dev and previews. + base: process.env.VITE_BASE ?? "/", plugins: [ react(), pyodideAssets(), diff --git a/docs/STATUS.md b/docs/STATUS.md index 471a7e7..8bc516d 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -23,8 +23,8 @@ What's **not** done: The goal of v0 is a **go / adjust / stop decision** from a playtest (PRD §4 hypotheses). Everything below serves that, in this order. ### 1. Put it in front of testers -- [ ] **CI:** a GitHub Actions workflow running `pnpm typecheck`, `pnpm test` and the e2e suite on every push. Claude can do this. -- [ ] **Deploy the web build** to a static host (Netlify, Cloudflare Pages, or GitHub Pages via Actions). Claude can write the workflow; the user connects the host. +- [x] **CI:** a GitHub Actions workflow (`.github/workflows/ci.yml`) running `pnpm typecheck`, `pnpm test` and the e2e suite on every push and PR. +- [x] **Deploy the web build** to GitHub Pages (`.github/workflows/deploy.yml`, builds on push to `main`). The user still needs to flip Settings → Pages → Source to "GitHub Actions" once, the first time it runs. - [ ] **Analytics collector:** a tiny endpoint that stores the JSON batches the app sends (`VITE_ANALYTICS_URL`), e.g. a serverless function. Alternatively, use only the device export in moderated sessions. Claude can write it; the user deploys it. - [ ] **Native test builds** on the user's Mac and in Android Studio, following [mobile.md](mobile.md). Optional: the web link already works on phones. - [ ] Walk through the pre-launch checklist in [playtest.md](playtest.md) §5. @@ -42,5 +42,5 @@ The goal of v0 is a **go / adjust / stop decision** from a playtest (PRD §4 hyp ## Open questions for the user 1. Tester recruiting channel and incentive (PRD §14). -2. Hosting choice for the web build and the analytics collector. +2. Hosting choice for the analytics collector (the web build now deploys to GitHub Pages). 3. Whether native builds are wanted for the first playtest, or the web link is enough.