Skip to content

Commit 3912344

Browse files
Updates
Signed-off-by: Kristin Brown <kristin.brown@solo.io>
1 parent d9793aa commit 3912344

1 file changed

Lines changed: 121 additions & 19 deletions

File tree

README.md

Lines changed: 121 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ sites — plus a bundled HTML test harness that any consumer repo can
66
re-run against its own built `public/`.
77

88
Two faces, one repo:
9-
- **Hugo theme module** — consumers import this via `go.mod`. Hextra
10-
comes along as a transitive dependency.
11-
- **Playwright HTML-only harness** — consumers point it at their built
12-
output via `make test CONFIG=path/to/.docs-test.toml`.
9+
- **Hugo theme module** — consumers import this via `go.mod`. Hextra comes along as a transitive dependency.
10+
- **Playwright HTML-only harness** — consumers point it at their built output via `make test CONFIG=path/to/.docs-test.toml`.
1311

1412
## Architecture
1513

@@ -56,11 +54,11 @@ A page rendered against this module loads CSS in this order:
5654
Each consumer declares one of two brand variants (or leaves it unset):
5755

5856
```toml
59-
# docs (enterprise)
57+
# Enterprise consumer
6058
[params.themeExtras]
6159
brand = "enterprise"
6260

63-
# agentgateway-oss-website
61+
# OSS consumer
6462
[params.themeExtras]
6563
brand = "oss"
6664

@@ -85,11 +83,12 @@ Some shortcodes need to know the page's section / version / build
8583
condition (e.g., `conditional-text`, `version`, `link-hextra`). Two
8684
URL conventions exist across consumers:
8785

88-
- `siteParams` — used by solo-io/docs (`docs.solo.io/<product>/<version>/...`,
89-
with `/docs/` in the domain). Reads `Site.Params.{folder, currentProduct,
90-
buildCondition, versions}`.
91-
- `url` — used by agentgateway-oss-website (`agentgateway.dev/docs/<section>/<version>/...`).
92-
Parses `Page.RelPermalink`.
86+
- `siteParams` — for multi-product hubs that mount each product at
87+
`<host>/<product>/<version>/...` and surface that mapping via
88+
`Site.Params.{folder, currentProduct, buildCondition, versions}`.
89+
- `url` — for single-site repos where the URL itself encodes section
90+
and version (e.g., `<host>/docs/<section>/<version>/...`). Parses
91+
`Page.RelPermalink`.
9392

9493
Each consumer picks one in their hugo config:
9594

@@ -136,14 +135,13 @@ etc.) and treat `@latest` / floating branch refs as unsupported.
136135
pageContextMode = "url" # or "siteParams"
137136
```
138137

139-
### 3. Run the harness in CI
140-
141-
Add a test config at the repo root:
138+
### 3. Add a test config at the consumer repo root
142139

143140
```toml
144141
# .docs-test.toml
145142
version = "1"
146143
name = "my-docs-site"
144+
brand = "oss" # or "enterprise"; matches params.themeExtras.brand
147145
builtRoot = "./public"
148146
baseURL = "/docs"
149147
buildLog = "./build.log"
@@ -157,20 +155,124 @@ versions = ["v1", "v2", "main"]
157155

158156
[checks]
159157
crossBrowser = false
158+
smoke = false # set true only for cross-product hub repos
160159

161160
[allowlists]
162161
hugoWarnings = []
163162
```
164163

165-
In CI, after building your site:
164+
### 4. Wire CI to check out the harness at the module pin
165+
166+
The harness lives here, in `tests/`. Each consumer's CI checks out
167+
`solo-io/docs-theme-extras` at the SHA pinned in its own `go.mod` (the
168+
pseudo-version that `hugo mod get` produced) so layouts and tests stay
169+
in lockstep — bumping the module pin is one PR that updates both.
170+
171+
The minimum-viable workflow for a single-site consumer:
172+
173+
```yaml
174+
# .github/workflows/framework-tests.yml
175+
name: Framework tests
176+
on: [pull_request, workflow_dispatch]
177+
jobs:
178+
framework-test-static:
179+
runs-on: ubuntu-latest
180+
continue-on-error: true # soft signal for the first ~week
181+
steps:
182+
- uses: actions/checkout@v6
183+
- uses: actions/setup-go@v6
184+
with: { go-version: 'stable', cache: false }
185+
- uses: peaceiris/actions-hugo@v3
186+
with: { hugo-version: '0.160.1', extended: true }
187+
188+
- name: Resolve docs-theme-extras SHA from go.mod
189+
id: theme-sha
190+
run: |
191+
sha=$(grep "docs-theme-extras" go.mod | grep -oE '[0-9a-f]{12}' | head -1)
192+
echo "sha=$sha" >> "$GITHUB_OUTPUT"
193+
194+
- uses: actions/checkout@v6
195+
with:
196+
repository: solo-io/docs-theme-extras
197+
ref: ${{ steps.theme-sha.outputs.sha }}
198+
path: docs-theme-extras
199+
200+
- uses: actions/setup-node@v6
201+
with:
202+
node-version: '20'
203+
cache: 'npm'
204+
cache-dependency-path: 'docs-theme-extras/package-lock.json'
205+
206+
- name: Build site
207+
run: hugo --gc --minify
208+
209+
- name: Install harness deps
210+
working-directory: docs-theme-extras
211+
run: npm ci
212+
213+
- name: Run static specs
214+
working-directory: docs-theme-extras
215+
env:
216+
DOCS_TEST_CONFIG: ${{ github.workspace }}/.docs-test.toml
217+
run: npx playwright test --project=static --reporter=list,html
218+
```
219+
220+
Multi-product hub repos (one site, many product subpaths) use the same
221+
pattern with extra jobs for `--project=browser` and a smoke matrix per
222+
product, plus per-product artifact downloads in place of the inline
223+
`hugo` build step.
224+
225+
### 5. Run the harness locally
226+
227+
The local-invocation pattern depends on the consumer repo's setup. Two
228+
working examples today:
229+
230+
**Pattern A — consumer ships Makefile targets that drive the harness
231+
from a sibling clone.** Recommended for repos where multiple developers
232+
will run tests regularly:
233+
234+
```sh
235+
# One-time: clone docs-theme-extras as a sibling
236+
git clone https://github.com/solo-io/docs-theme-extras ../docs-theme-extras
237+
cd <consumer-repo>
238+
make test-install # npm + Playwright browsers in the sibling
239+
240+
# Build the test fixture / site, then run a project
241+
make test # all projects (static, browser, cross-browser)
242+
make test-static # fastest loop — ~2s after Hugo build
243+
make test-browser # chromium only
244+
make test-cross-browser # chromium + firefox + webkit
245+
make test-smoke PRODUCT=<name> # multi-product hubs only
246+
247+
# Override the sibling location if needed
248+
make test THEME_EXTRAS_DIR=/abs/path/to/docs-theme-extras
249+
```
250+
251+
The sibling-clone pattern, the `THEME_EXTRAS_DIR` override variable, and
252+
the per-target signatures are conventions a Makefile-shipping consumer
253+
opts into. See `Makefile` examples in the consumer repos for the full
254+
template.
255+
256+
**Pattern B — consumer invokes the harness directly.** Works for any
257+
consumer without Makefile scaffolding; useful as a starter or for
258+
ad-hoc runs:
166259

167260
```sh
168-
git clone https://github.com/solo-io/docs-theme-extras
169-
cd docs-theme-extras
170-
make install
171-
make test CONFIG=$GITHUB_WORKSPACE/.docs-test.toml
261+
# One-time: clone docs-theme-extras as a sibling and install
262+
git clone https://github.com/solo-io/docs-theme-extras ../docs-theme-extras
263+
cd ../docs-theme-extras && npm ci && npx playwright install --with-deps chromium
264+
265+
# Build the consumer site, then run the harness against it
266+
cd <consumer-repo> && hugo --gc --minify
267+
cd ../docs-theme-extras && \
268+
DOCS_TEST_CONFIG=$(pwd)/../<consumer-repo>/.docs-test.toml \
269+
npx playwright test --project=static
172270
```
173271

272+
Either pattern resolves `builtRoot` from the consumer's `.docs-test.toml`,
273+
so any consumer can run the same harness against its own `public/` once
274+
the config is in place.
275+
174276
## Local development of this module
175277

176278
```sh

0 commit comments

Comments
 (0)