Files
playkit/docs/CONSUMER.md
ilia 6d88818fae
CI / skip-ci-check (pull_request) Successful in 5s
CI / release (pull_request) Has been skipped
CI / build-and-test (pull_request) Successful in 24s
CI / selftest (pull_request) Successful in 23s
CI / secret-scan (pull_request) Successful in 4s
Release 0.4.0: npm registry publish, playkit CLI, retry presets
Add Gitea npm publish on tag release, `playkit init`/`smoke` CLI,
and PLAYKIT_RETRY_PRESET profiles. Document install + consumer scaffold.
2026-07-15 09:06:23 -04:00

84 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# How to adopt @levkin/playkit in an app repo
## 1. Depend on a release
**Preferred (Gitea npm registry):**
```bash
# .npmrc — see docs/NPM_REGISTRY.md
# @levkin:registry=https://git.levkin.ca/api/packages/ilia/npm/
npm install @levkin/playkit@0.4.0
npm install -D @playwright/test
npx playwright install chromium
```
**Fallback (git pin):**
```bash
npm install git+https://git.levkin.ca/ilia/playkit.git#v0.4.0
```
**Scaffold:**
```bash
npx --yes @levkin/playkit init
# or: playkit init
```
## 2. Layout
```
e2e/
playwright.config.ts
fixtures.ts
pages/LoginPage.ts
tests/auth.signout.spec.ts
api/health.spec.ts
```
## 3. Config (Infisical → CI secrets)
Store in Infisical `LevkinOps` / `Development` (path e.g. `/playkit/punimtag`):
- `PLAYKIT_BASE_URL=https://punimtagdev.levkin.ca`
- `E2E_ADMIN_EMAIL` / `E2E_ADMIN_PASSWORD` (dedicated test user — not a humans password)
- optional `PLAYKIT_PUSHGATEWAY_URL=http://10.0.10.24:9091`
- optional `PLAYKIT_RETRY_PRESET=strictCi|flakyNetwork|default`
- for mail specs: `PLAYKIT_MAIL_PROVIDER=mailpit` (default) + `MAILPIT_*`, or `MAILTRAP_*`
Sync into Gitea Actions secrets for the consumer repo.
## 4. Post-deploy smoke
```bash
PLAYKIT_BASE_URL=https://punimtagdev.levkin.ca playkit smoke
# or: playkit smoke --path /api/health
```
## 5. CI job sketch
See `e2e/ci-snippet.yml` from `playkit init`, or:
```yaml
e2e:
runs-on: [homelab, self-hosted, linux]
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npx playwright install --with-deps chromium
- run: npx playwright test
env:
PLAYKIT_BASE_URL: ${{ secrets.PLAYKIT_BASE_URL }}
PLAYKIT_RETRY_PRESET: strictCi
E2E_ADMIN_EMAIL: ${{ secrets.E2E_ADMIN_EMAIL }}
E2E_ADMIN_PASSWORD: ${{ secrets.E2E_ADMIN_PASSWORD }}
```
## 6. Deploy rule
PR → CI green (unit + e2e when secrets present) → merge → documented deploy script.
Do not claim “fixed” from a bare `pct exec` hotfix without a follow-up PR.
**Adoption pause:** soak punimtag + kit CI a few more days before migrating
`screening` / `slack-sieve` / `portfolio`. See `docs/IDEAS.md`.