mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 18:11:51 +08:00
Closes DOCS-1210 Closes DOCS-1209 #48226 needs to merge first for CI failure ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Test coverage and several small bug fixes discovered during implementation. ## What is the current behavior? Nothing verified that `pnpm run dev:docs` keeps working without private credentials. We value this command working, especially for community contributors. However, this issue can go undetected by employees at Supabase since many of us have credentials in place. We do not want this to go a week before finding and fixing like in the previous instance. ## What is the new behavior? - **New Playwright test suite**: `e2e/docs/local-smoke/no-credentials.spec.ts` boots the docs dev server with zero GitHub App/Supabase secrets and checks 5 routes covering each known failure point. - **CI**: a new `local-dev-smoke` job in `docs-tests.yml` runs this suite with no credentials configured. ## Additional bugs resolved Setting up this test exposed other issues that are fixed in this PR: - **Troubleshooting.utils.ts crash** — Unguarded Supabase call pattern, crashing every troubleshooting article. Added the same guard as previous fixes. - **Missing manifest.json** — middleware.ts statically imports public/markdown/manifest.json, which is gitignored and only generated by a build step that's skipped in local dev. On a fresh checkout it doesn't exist, so middleware fails to compile and takes down every page. Fixed by committing a placeholder [] (real builds still regenerate the full file). - **Phantom @code-hike/mdx import** — apps/docs/app/layout.tsx imported @code-hike/mdx/styles.css, but only apps/www actually declares that dependency. Worked by accident whenever both apps were installed together; broke in CI's docs-only install. Turned out to be dead code (nothing in docs actually uses code-hike), so fixed by deleting the unused imports rather than adding the dependency. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit * **New Features** * Added a credential-free “local smoke” end-to-end test suite for key documentation routes. * **Bug Fixes** * Improved troubleshooting behavior when required external service credentials are missing. * Updated federated “wrappers” documentation pages to gracefully show a fallback message when external content can’t be fetched. * **Tests** * Added a dedicated local-smoke Playwright runner and enhanced CI path-based triggering and reporting (failure-focused artifacts). * **Chores** * Refined docs workflow path filters and adjusted docs markdown manifest/ignore rules for generated content. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
127 lines
3.9 KiB
YAML
127 lines
3.9 KiB
YAML
name: Docs Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches: ['master']
|
|
paths:
|
|
- 'apps/docs/**/*.ts*'
|
|
- 'apps/docs/spec/**/*.json'
|
|
- 'apps/docs/.env.development'
|
|
- 'apps/docs/package.json'
|
|
- 'e2e/docs/local-smoke/**'
|
|
- 'e2e/docs/playwright.local-smoke.config.ts'
|
|
- 'e2e/docs/package.json'
|
|
|
|
# Cancel old builds on new commit for same workflow + branch/PR
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
CI: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
sparse-checkout: |
|
|
apps/docs
|
|
examples
|
|
packages
|
|
supabase
|
|
patches
|
|
|
|
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
|
|
name: Install pnpm
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install deps
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Download JS reference TypeDoc dumps
|
|
# The source dumps under apps/docs/spec/reference/<lib>/<ver>/*.json are
|
|
# gitignored — `make download.tsdoc.v2` re-fetches them from
|
|
# supabase.github.io so the reference-content snapshot test has
|
|
# something to walk.
|
|
working-directory: apps/docs/spec
|
|
run: make download.tsdoc.v2
|
|
|
|
- name: Generate Dart reference dump
|
|
# Dart has no upstream TypeDoc dump; its gitignored dump is generated
|
|
# from the committed `supabase_dart_v2.yml` so the reference-content
|
|
# snapshot test has something to walk.
|
|
working-directory: apps/docs
|
|
run: pnpm run codegen:references:dart
|
|
|
|
- name: Run tests
|
|
run: |
|
|
touch .env
|
|
# Needed to prevent local Supabase startup from erroring, due to
|
|
# GitHub Auth being enabled in config
|
|
echo "GITHUB_CLIENT_ID=dummy-id" >> .env
|
|
echo "GITHUB_SECRET=dummy-secret" >> .env
|
|
pnpm run test:docs
|
|
|
|
local-dev-smoke:
|
|
name: Local dev smoke (no credentials)
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
sparse-checkout: |
|
|
apps/docs
|
|
examples
|
|
packages
|
|
supabase
|
|
patches
|
|
e2e/docs
|
|
|
|
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
|
|
name: Install pnpm
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install deps
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Install Playwright Chromium
|
|
run: pnpm -C e2e/docs exec playwright install chromium --with-deps --only-shell
|
|
|
|
# Deliberately does not set DOCS_GITHUB_APP_*, SUPABASE_SECRET_KEY,
|
|
# OPENAI_API_KEY, or DOCS_REVALIDATION_KEYS — their absence here is what
|
|
# verifies `pnpm run dev:docs` still works without private credentials.
|
|
- name: Run local dev smoke tests
|
|
run: pnpm run e2e:docs:local-smoke
|
|
|
|
- name: Upload Playwright report
|
|
if: failure()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: docs-local-smoke-playwright-report
|
|
path: |
|
|
e2e/docs/playwright-report-local-smoke/
|
|
e2e/docs/test-results/
|
|
retention-days: 7
|