Skip to content

Commit c5df861

Browse files
levi0005Jambox11
andauthored
Feat/smoke env docs cleanup ci (#584)
* test: add Playwright smoke coverage for login and wallets Adds tests/e2e/login.spec.ts and tests/e2e/wallets.spec.ts covering the primary login (empty state, validation, success, failure) and wallet monitoring (auth redirect, loading/error/empty/populated table, add wallet modal, sidebar nav) paths, run against desktop and a narrow mobile (Pixel 7) viewport via playwright.config.ts. Adds the @playwright/test devDependency and test:e2e / test:e2e:ui scripts. * docs: document frontend env vars in README Adds a full environment variable reference table to README.md and a companion docs/frontend-env-vars.md covering every NEXT_PUBLIC_* and server-only var read by the app (src/lib/env.ts, src/lib/api/config.ts, the auth/wallets API routes, and the analytics tracking hooks), clarifies that network selection (testnet vs mainnet) is driven purely by which backend NEXT_PUBLIC_API_URL points at, and expands .env.example to list every documented variable with inline comments. * docs: remove obsolete feature markdown clutter from root Deletes 44 stale implementation-summary / PR-description / checklist markdown files from the repo root (ADDRESS_*, ANALYTICS_*, RECOVERY_*, WALLETS_UI_*, IMPLEMENTATION_*, etc.). They only ever cross-referenced each other, were superseded by the current README and docs/ folder, and made it hard to find the docs that actually matter. Points README.md at docs/ for ongoing reference material and keeps the root to just README.md. * ci: ensure next build passes typecheck in CI Splits .github/workflows/ci.yml into typecheck, unit-tests, and a testnet/mainnet build matrix (previously the workflow never ran the Vitest suite in CI at all, and built only once against a single hardcoded API URL). Adds a `typecheck` npm script so CI and local runs use the identical command, excludes tests/e2e and playwright.config.ts from the app tsconfig so Playwright's own types don't leak into the strict app-wide tsc pass, and dedupes the duplicate @storybook/* keys in package.json devDependencies. See docs/ci-typecheck.md for the full rundown, including a follow-up note that pnpm-lock.yaml still needs a local `pnpm install` to pick up the @playwright/test devDependency added earlier in this branch. --------- Co-authored-by: James Aklo <jamesjambox@gmail.com>
1 parent d1a4a70 commit c5df861

58 files changed

Lines changed: 619 additions & 15129 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1-
# Base URL for the Mux backend API (no trailing slash)
1+
# Frontend environment variables — see the "Environment variables" section
2+
# of README.md for full descriptions, defaults, and testnet/mainnet notes.
3+
# Copy this file to .env.local and fill in real values as needed; every
4+
# var here is optional in local development.
5+
6+
# Base URL for the Mux backend API (no trailing slash).
7+
# Point at a testnet-configured backend for staging, or the production
8+
# backend for mainnet. Falls back to an in-repo mock when unset.
29
# Example: https://api.muxprotocol.com
310
NEXT_PUBLIC_API_URL=
11+
12+
# Legacy alias for NEXT_PUBLIC_API_URL, checked second in the fallback chain.
13+
NEXT_PUBLIC_MUX_API_URL=
14+
15+
# Public-facing URL of this application (used for absolute links).
16+
NEXT_PUBLIC_APP_URL=
17+
18+
# Client-visible Mux Protocol API key. Never put secrets here — anything
19+
# prefixed NEXT_PUBLIC_ ships in client-side JS.
20+
NEXT_PUBLIC_MUX_API_KEY=
21+
22+
# WalletConnect project ID, only needed if wallet-connect flows are enabled.
23+
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=
24+
25+
# --- Server-only vars (never exposed to the browser) ---
26+
27+
# Mux Protocol API key/secret used by Next.js API routes / server components.
28+
MUX_API_KEY=
29+
MUX_API_SECRET=
30+
31+
# Database connection string, if this deployment persists data outside
32+
# the backend API.
33+
DATABASE_URL=

.github/workflows/ci.yml

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
build-and-test:
19-
name: Build and test
18+
typecheck:
19+
name: Typecheck
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4
@@ -33,10 +33,69 @@ jobs:
3333
- name: Install dependencies
3434
run: pnpm install --frozen-lockfile
3535

36+
# Runs `tsc --noEmit` against the same tsconfig.json used by `next
37+
# build` (via the `next` compiler plugin), so a type error here is
38+
# guaranteed to also fail the build step below. This job intentionally
39+
# runs before build/test so type errors fail fast.
3640
- name: Typecheck
37-
run: pnpm exec tsc --noEmit
41+
run: pnpm run typecheck
42+
43+
unit-tests:
44+
name: Unit tests (Vitest)
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- uses: pnpm/action-setup@v4
50+
with:
51+
version: 9
52+
53+
- uses: actions/setup-node@v4
54+
with:
55+
node-version: "22"
56+
cache: "pnpm"
57+
58+
- name: Install dependencies
59+
run: pnpm install --frozen-lockfile
60+
61+
- name: Run unit/component tests
62+
run: pnpm test
63+
64+
build:
65+
name: Build (${{ matrix.network }})
66+
needs: [typecheck, unit-tests]
67+
runs-on: ubuntu-latest
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
# `next build` type-checks and statically analyzes every route,
72+
# including the API routes that branch on NEXT_PUBLIC_API_URL
73+
# (see src/app/api/auth/login/route.ts and
74+
# src/lib/api/config.ts::getApiBaseUrl()). Building once with a
75+
# testnet-shaped URL and once with a mainnet-shaped URL catches
76+
# env-specific breakage before it reaches either environment.
77+
network: [testnet, mainnet]
78+
include:
79+
- network: testnet
80+
api_url: https://testnet-api.example.com
81+
- network: mainnet
82+
api_url: https://api.example.com
83+
steps:
84+
- uses: actions/checkout@v4
85+
86+
- uses: pnpm/action-setup@v4
87+
with:
88+
version: 9
89+
90+
- uses: actions/setup-node@v4
91+
with:
92+
node-version: "22"
93+
cache: "pnpm"
94+
95+
- name: Install dependencies
96+
run: pnpm install --frozen-lockfile
3897

3998
- name: Build
4099
run: pnpm run build
41100
env:
42-
NEXT_PUBLIC_API_URL: https://api.example.com
101+
NEXT_PUBLIC_API_URL: ${{ matrix.api_url }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
# testing
1515
/coverage
16+
/playwright-report
17+
/test-results
18+
/blob-report
19+
/playwright/.cache
1620

1721
# next.js
1822
/.next/

0 commit comments

Comments
 (0)