|
17 | 17 | - 'bun.lock' |
18 | 18 | - '.github/workflows/docs-negotiation.yml' |
19 | 19 | workflow_dispatch: |
| 20 | + inputs: |
| 21 | + benchmark: |
| 22 | + description: Run bounded production navigation, image and Lighthouse measurements |
| 23 | + type: boolean |
| 24 | + default: false |
| 25 | + build_ref: |
| 26 | + description: Commit to build for the benchmark (empty uses this workflow revision) |
| 27 | + type: string |
| 28 | + default: '' |
| 29 | + preview_artifact: |
| 30 | + description: Save the verified production build for local visual inspection |
| 31 | + type: boolean |
| 32 | + default: false |
| 33 | + benchmark_scope: |
| 34 | + description: Full measurements, navigation without Lighthouse, or only interactive controls |
| 35 | + type: choice |
| 36 | + options: [full, navigation, interactions] |
| 37 | + default: full |
| 38 | + benchmark_production: |
| 39 | + description: Also measure the public production origin (only when it permits automated access) |
| 40 | + type: boolean |
| 41 | + default: false |
20 | 42 |
|
21 | 43 | permissions: |
22 | 44 | contents: read |
23 | 45 |
|
24 | 46 | concurrency: |
25 | | - group: docs-negotiation-${{ github.ref }} |
26 | | - cancel-in-progress: true |
| 47 | + group: docs-negotiation-${{ github.ref }}-${{ inputs.benchmark && 'benchmark' || 'verification' }} |
| 48 | + cancel-in-progress: ${{ !inputs.benchmark }} |
27 | 49 |
|
28 | 50 | jobs: |
| 51 | + benchmark: |
| 52 | + if: github.event_name == 'workflow_dispatch' && inputs.benchmark |
| 53 | + name: docs benchmark (${{ matrix.target }}) |
| 54 | + runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-8vcpu-ubuntu-2404' || 'linux-x64-8-core' }} |
| 55 | + timeout-minutes: 150 |
| 56 | + strategy: |
| 57 | + fail-fast: false |
| 58 | + max-parallel: 2 |
| 59 | + matrix: |
| 60 | + target: ${{ fromJSON(inputs.benchmark_production && '["build","production"]' || '["build"]') }} |
| 61 | + env: |
| 62 | + DATABASE_URL: '' |
| 63 | + OPENAI_API_KEY: '' |
| 64 | + DOCS_BENCHMARK_BASE_URL: ${{ matrix.target == 'production' && 'https://docs.sim.ai' || 'http://127.0.0.1:3001' }} |
| 65 | + steps: |
| 66 | + - name: Checkout measured revision |
| 67 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 |
| 68 | + with: |
| 69 | + ref: ${{ inputs.build_ref || github.sha }} |
| 70 | + fetch-depth: 0 |
| 71 | + filter: blob:none |
| 72 | + - name: Setup workspace |
| 73 | + uses: ./.github/actions/setup |
| 74 | + with: |
| 75 | + provider: ${{ vars.CI_PROVIDER }} |
| 76 | + - name: Checkout benchmark harness |
| 77 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 |
| 78 | + with: |
| 79 | + ref: ${{ github.sha }} |
| 80 | + path: .readiness-harness |
| 81 | + sparse-checkout: apps/docs/scripts/benchmark-readiness.ts |
| 82 | + sparse-checkout-cone-mode: false |
| 83 | + - name: Prepare measurements |
| 84 | + env: |
| 85 | + GH_TOKEN: ${{ github.token }} |
| 86 | + MEASURED_TARGET: ${{ matrix.target }} |
| 87 | + run: | |
| 88 | + mkdir -p test-results/benchmark |
| 89 | + cp .readiness-harness/apps/docs/scripts/benchmark-readiness.ts apps/docs/scripts/benchmark-readiness.ts |
| 90 | + if [ "$MEASURED_TARGET" = production ]; then |
| 91 | + gh api "repos/$GITHUB_REPOSITORY/deployments?environment=Production&per_page=1" >test-results/benchmark/deployment.json |
| 92 | + # Candidate deployments do not establish which revision owns the public alias. |
| 93 | + REVISION=unverified-public-origin |
| 94 | + else |
| 95 | + REVISION=$(git rev-parse HEAD) |
| 96 | + fi |
| 97 | + echo "DOCS_BENCHMARK_REVISION=$REVISION" >> "$GITHUB_ENV" |
| 98 | + bunx --no-install playwright install --with-deps chromium |
| 99 | + - name: Build measured production docs |
| 100 | + id: build |
| 101 | + if: matrix.target == 'build' |
| 102 | + run: bun run --cwd apps/docs build |
| 103 | + - name: Measure navigation and Lighthouse sequentially |
| 104 | + env: |
| 105 | + BENCHMARK_SCOPE: ${{ inputs.benchmark_scope || 'full' }} |
| 106 | + run: | |
| 107 | + if [ "$DOCS_BENCHMARK_BASE_URL" = http://127.0.0.1:3001 ]; then |
| 108 | + bun run --cwd apps/docs start --port 3001 >test-results/benchmark/server.log 2>&1 & |
| 109 | + DOCS_SERVER_PID=$! |
| 110 | + trap 'kill "$DOCS_SERVER_PID" 2>/dev/null || true' EXIT |
| 111 | + for attempt in $(seq 1 30); do |
| 112 | + curl -fsS "$DOCS_BENCHMARK_BASE_URL/introduction" -o /dev/null && break |
| 113 | + sleep 1 |
| 114 | + done |
| 115 | + fi |
| 116 | + NAVIGATION_STATUS=0 |
| 117 | + LIGHTHOUSE_STATUS=0 |
| 118 | + if [ "$BENCHMARK_SCOPE" = interactions ]; then |
| 119 | + export DOCS_BENCHMARK_SCENARIOS=interactions |
| 120 | + fi |
| 121 | + DOCS_BENCHMARK_MODE=navigation DOCS_BENCHMARK_REPORT_PATH="$GITHUB_WORKSPACE/test-results/benchmark/navigation.json" bun run --cwd apps/docs scripts/benchmark-readiness.ts || NAVIGATION_STATUS=$? |
| 122 | + if [ "$BENCHMARK_SCOPE" = full ]; then |
| 123 | + DOCS_BENCHMARK_MODE=lighthouse DOCS_BENCHMARK_REPORT_PATH="$GITHUB_WORKSPACE/test-results/benchmark/lighthouse.json" bun run --cwd apps/docs scripts/benchmark-readiness.ts || LIGHTHOUSE_STATUS=$? |
| 124 | + fi |
| 125 | + test "$NAVIGATION_STATUS" -eq 0 && test "$LIGHTHOUSE_STATUS" -eq 0 |
| 126 | + - name: Upload measurements |
| 127 | + if: always() |
| 128 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 129 | + with: |
| 130 | + name: docs-benchmark-${{ matrix.target }} |
| 131 | + path: test-results/benchmark/ |
| 132 | + retention-days: 14 |
| 133 | + - name: Package measured production preview |
| 134 | + if: always() && inputs.preview_artifact && steps.build.outcome == 'success' |
| 135 | + run: tar -czf docs-preview-build.tar.gz --exclude='.next/cache' -C apps/docs .next .content |
| 136 | + - name: Upload measured production preview |
| 137 | + if: always() && inputs.preview_artifact && steps.build.outcome == 'success' |
| 138 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 139 | + with: |
| 140 | + name: docs-preview-build |
| 141 | + path: docs-preview-build.tar.gz |
| 142 | + retention-days: 3 |
| 143 | + |
29 | 144 | http: |
| 145 | + if: github.event_name != 'workflow_dispatch' || !inputs.benchmark |
30 | 146 | name: docs HTTP |
31 | 147 | runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-8vcpu-ubuntu-2404' || 'linux-x64-8-core' }} |
32 | | - timeout-minutes: 15 |
| 148 | + timeout-minutes: 45 |
| 149 | + services: |
| 150 | + search-postgres: |
| 151 | + image: pgvector/pgvector:pg17 |
| 152 | + env: |
| 153 | + POSTGRES_USER: docs_test |
| 154 | + POSTGRES_PASSWORD: docs_test |
| 155 | + POSTGRES_DB: docs_search_test |
| 156 | + ports: |
| 157 | + - 5432:5432 |
| 158 | + options: >- |
| 159 | + --health-cmd "pg_isready -U docs_test -d docs_search_test" |
| 160 | + --health-interval 5s |
| 161 | + --health-timeout 5s |
| 162 | + --health-retries 10 |
33 | 163 | env: |
34 | 164 | DATABASE_URL: postgresql://docs_test:docs_test@127.0.0.1:1/docs_test |
35 | 165 | DOCS_E2E_BASE_URL: http://127.0.0.1:3001 |
36 | | - DOCS_NEGOTIATION_REPORT_PATH: ${{ github.workspace }}/test-results/docs-negotiation.json |
37 | | - DOCS_HEADER_REPORT_PATH: ${{ github.workspace }}/test-results/docs-headers.json |
38 | | - DOCS_NAVIGATION_REPORT_PATH: ${{ github.workspace }}/test-results/navigation/docs.json |
| 166 | + DOCS_NEGOTIATION_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/docs-negotiation.json |
| 167 | + DOCS_SEARCH_E2E_DATABASE_URL: postgresql://docs_test:docs_test@127.0.0.1:5432/docs_search_test |
| 168 | + DOCS_SEARCH_E2E_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/search-postgres/report.json |
| 169 | + DOCS_INTERFACES_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/docs-interfaces.json |
| 170 | + DOCS_CORPUS_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/docs-corpus.json |
| 171 | + DOCS_HEADER_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/docs-headers.json |
| 172 | + DOCS_NAVIGATION_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/navigation/docs.json |
| 173 | + DOCS_GENERATORS_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/generators/report.json |
| 174 | + DOCS_MIGRATION_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/migration.json |
| 175 | + DOCS_SAMPLES_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/samples/report.json |
| 176 | + DOCS_SAMPLES_SYNTAX_LANGUAGES: javascript,python,bash,go,java,csharp |
| 177 | + DOCS_SAMPLES_HTTP_BASE_URL: http://127.0.0.1:3001 |
| 178 | + DOCS_PROVIDER_E2E_DATABASE_URL: postgresql://docs_test:docs_test@127.0.0.1:5432/docs_search_test |
| 179 | + DOCS_PROVIDER_E2E_BASE_URL: http://127.0.0.1:3001 |
| 180 | + DOCS_PROVIDER_E2E_REPORT_PATH: ${{ github.workspace }}/apps/docs/test-results/platform-consumer/report.json |
39 | 181 | steps: |
40 | 182 | - name: Checkout code |
41 | 183 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 |
| 184 | + with: |
| 185 | + fetch-depth: 0 |
| 186 | + filter: blob:none |
42 | 187 | - name: Setup workspace |
43 | 188 | uses: ./.github/actions/setup |
44 | 189 | with: |
45 | 190 | provider: ${{ vars.CI_PROVIDER }} |
46 | 191 | - name: Build production docs |
| 192 | + id: build |
47 | 193 | run: bun run --cwd apps/docs build |
| 194 | + - name: Verify generator idempotence and authored regions |
| 195 | + run: bun run --cwd apps/docs scripts/test-generators-e2e.ts |
| 196 | + - name: Verify preserved routes, anchors and examples |
| 197 | + if: always() && steps.build.outcome == 'success' |
| 198 | + run: bun run --cwd apps/docs content:verify-migration |
48 | 199 | - name: Verify native header edge cases |
| 200 | + if: always() && steps.build.outcome == 'success' |
49 | 201 | run: bun run --cwd apps/docs test:headers:e2e |
| 202 | + - name: Verify isolated PostgreSQL search and index lifecycle |
| 203 | + if: always() && steps.build.outcome == 'success' |
| 204 | + run: bun run --cwd apps/docs test:search:postgres:e2e |
| 205 | + - name: Set up Java for copied request examples |
| 206 | + if: always() && steps.build.outcome == 'success' |
| 207 | + uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5 |
| 208 | + with: |
| 209 | + distribution: temurin |
| 210 | + java-version: '17' |
| 211 | + - name: Set up .NET for copied request examples |
| 212 | + if: always() && steps.build.outcome == 'success' |
| 213 | + uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5 |
| 214 | + with: |
| 215 | + dotnet-version: '8.0.x' |
| 216 | + - name: Set up Go for copied request examples |
| 217 | + if: always() && steps.build.outcome == 'success' |
| 218 | + uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6 |
| 219 | + with: |
| 220 | + go-version: '1.25.x' |
| 221 | + cache: false |
50 | 222 | - name: Install browser for navigation checks |
51 | | - run: bunx --no-install playwright install --with-deps chromium |
| 223 | + if: always() && steps.build.outcome == 'success' |
| 224 | + run: bunx --no-install playwright install --with-deps chromium webkit |
52 | 225 | - name: Verify HTTP content negotiation |
| 226 | + if: always() && steps.build.outcome == 'success' |
53 | 227 | run: | |
54 | | - mkdir -p test-results |
55 | | - bun run --cwd apps/docs start --port 3001 >test-results/docs-server.log 2>&1 & |
| 228 | + mkdir -p apps/docs/test-results |
| 229 | + bun run --cwd apps/docs start --port 3001 >apps/docs/test-results/docs-server.log 2>&1 & |
56 | 230 | DOCS_SERVER_PID=$! |
57 | 231 | trap 'kill "$DOCS_SERVER_PID" 2>/dev/null || true' EXIT |
58 | | - bun run --cwd apps/docs test:negotiation:e2e |
59 | | - bun run --cwd apps/docs test:navigation:e2e |
| 232 | + STATUS=0 |
| 233 | + bun run --cwd apps/docs test:negotiation:e2e || STATUS=1 |
| 234 | + bun run --cwd apps/docs scripts/test-docs-interfaces-e2e.ts || STATUS=1 |
| 235 | + bun run --cwd apps/docs test:corpus:e2e || STATUS=1 |
| 236 | + bun run --cwd apps/docs scripts/verify-api-samples.ts || STATUS=1 |
| 237 | + bun --cwd apps/sim --no-env-file scripts/test-docs-search-provider-e2e.ts || STATUS=1 |
| 238 | + bun run --cwd apps/docs test:navigation:e2e || STATUS=1 |
| 239 | + DOCS_NAVIGATION_BROWSER=webkit DOCS_NAVIGATION_REPORT_PATH="$GITHUB_WORKSPACE/apps/docs/test-results/navigation-webkit/docs.json" bun run --cwd apps/docs test:navigation:e2e || STATUS=1 |
| 240 | + exit "$STATUS" |
| 241 | + - name: Package production preview for visual inspection |
| 242 | + if: always() && inputs.preview_artifact && steps.build.outcome == 'success' |
| 243 | + run: tar -czf docs-preview-build.tar.gz --exclude='.next/cache' -C apps/docs .next .content |
| 244 | + - name: Upload production preview |
| 245 | + if: always() && inputs.preview_artifact && steps.build.outcome == 'success' |
| 246 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 247 | + with: |
| 248 | + name: docs-preview-build |
| 249 | + path: docs-preview-build.tar.gz |
| 250 | + retention-days: 3 |
60 | 251 | - name: Upload HTTP regression report |
61 | 252 | if: always() |
62 | 253 | uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
63 | 254 | with: |
64 | 255 | name: docs-negotiation-report |
65 | | - path: test-results/ |
| 256 | + path: apps/docs/test-results/ |
66 | 257 | if-no-files-found: warn |
67 | 258 | retention-days: 14 |
0 commit comments