diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99a71bb3..3f6f529e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,8 @@ concurrency: jobs: # Which parts changed: the app (anything outside website/, docs/, design/, .claude/, .gitignore, Markdown files and the # Python scripts, as verify.sh sorts them; CONTEXT.md counts as app, for its vocabulary check), the site (website/, - # and docs/release-notes/, which the site's changelog test reads), the Mixer Link test bench (tools/mixer-sim) and + # docs/release-notes/, which the site's changelog test reads, and the Kit's Package.swift, whose ShowKit version + # website/tests/showKit.ts checks), the Mixer Link test bench (tools/mixer-sim) and # the Python scripts (scripts/*.py and scripts/hermes/, which build nothing; shell scripts still count as app). # A change to this workflow runs all four. changes: @@ -49,7 +50,7 @@ jobs: py='^scripts/[^/]*\.py$|^scripts/hermes/|^scripts/__pycache__/' if printf '%s\n' "$files" | grep -vE "$py" | grep -qvE '^website/|^docs/|^design/|^\.claude/|^\.gitignore$|\.md$|^$'; then app=true; fi if printf '%s\n' "$files" | grep -qxE 'CONTEXT\.md'; then app=true; fi - if printf '%s\n' "$files" | grep -qE '^website/|^docs/release-notes/|^\.github/workflows/ci\.yml$'; then site=true; fi + if printf '%s\n' "$files" | grep -qE '^website/|^docs/release-notes/|^Packages/ShowRecorderKit/Package\.swift$|^\.github/workflows/ci\.yml$'; then site=true; fi if printf '%s\n' "$files" | grep -qE '^tools/mixer-sim/|^\.github/workflows/ci\.yml$'; then mixersim=true; fi if printf '%s\n' "$files" | grep -qE "$py"'|^\.github/workflows/ci\.yml$'; then scripts=true; fi # An app change runs verify.sh's everything plan locally; here it runs the script tests too. diff --git a/website/tests/autoGainDoc.test.ts b/website/tests/autoGainDoc.test.ts index 83a51445..f4287934 100644 --- a/website/tests/autoGainDoc.test.ts +++ b/website/tests/autoGainDoc.test.ts @@ -1,6 +1,7 @@ import { existsSync, readFileSync } from "node:fs"; import path from "node:path"; import { DOCS } from "@/lib/docs"; +import { showKit } from "./showKit"; // The auto-gain docs page (/docs/auto-gain). A TestFlight tester couldn't find auto-gain (2026-11-01): it was only a // Pro bullet. The page takes its facts from the app's own code, so these checks read the Swift sources. @@ -34,8 +35,7 @@ describe("the auto-gain docs page", () => { }); it("names the same target level as the auto-gain rule", () => { - const target = swift("Packages/ShowRecorderKit/Sources/AutoGain/AutoGainRule.swift").match(/targetDbfs: Double = (-?\d+)/)![1]; - expect(page()).toContain(`${target} dBFS`); + expect(page()).toContain(`${showKit().autoGainTargetDbfs} dBFS`); }); it("quotes every reason the sheet gives when auto-gain can't run, word for word", () => { diff --git a/website/tests/channelArmingCopy.test.ts b/website/tests/channelArmingCopy.test.ts index 427c2582..a3084f27 100644 --- a/website/tests/channelArmingCopy.test.ts +++ b/website/tests/channelArmingCopy.test.ts @@ -2,6 +2,7 @@ import { existsSync, readFileSync } from "node:fs"; import path from "node:path"; import { DOCS } from "@/lib/docs"; import { featureGroups, inBetaFeatures } from "@/lib/features"; +import { showKit } from "./showKit"; // Choosing which USB Channels record (#991). On for everyone in the app since #1138, but the App Store version is // still 1.1, so the site lists it in the beta until 1.2 reaches the App Store. The facts come from the app's own code. @@ -32,11 +33,7 @@ describe("choosing which channels record", () => { }); it("uses the app's own words for the menu and the header", () => { - const item = swift("Packages/ShowRecorderKit/Sources/Recording/ChannelArmMenuItem.swift"); - for (const name of ["Don't arm channel", "Arm channel"]) { - expect(item).toContain(`"${name}"`); - expect(page()).toContain(`**${name} 5**`); - } + for (const name of showKit().channelArmMenuNames) expect(page()).toContain(`**${name} 5**`); const state = swift("Packages/ShowRecorderKit/Sources/Recording/RecordScreenState.swift"); expect(state).toContain("of \\(s.usbChannelCount) armed"); expect(page()).toContain("13 of 18 armed"); diff --git a/website/tests/showKit.ts b/website/tests/showKit.ts new file mode 100644 index 00000000..f60a7c4c --- /dev/null +++ b/website/tests/showKit.ts @@ -0,0 +1,23 @@ +import { readFileSync } from "node:fs"; +import path from "node:path"; + +// The app's words and numbers that live in ShowKit (github.com/ericdahl-dev/ShowKit), not in this repository, since +// #1294 and #1296. The site's tests can't read that source, so these are copied from it, and `showKit()` fails when +// ShowRecorder pins another ShowKit version: read the sources named below at the new tag, correct what changed (and +// the pages that quote it), then set CONFIRMED_AT to that version. +const CONFIRMED_AT = "0.2.0"; + +const COPIED = { + // Sources/AutoGain/AutoGainRule.swift: `targetDbfs: Double = -18` + autoGainTargetDbfs: "-18", + // Sources/Meters/ChannelArmMenuItem.swift: `accessibilityName` + channelArmMenuNames: ["Don't arm channel", "Arm channel"], +}; + +export function showKit() { + const manifest = readFileSync(path.resolve(__dirname, "..", "..", "Packages", "ShowRecorderKit", "Package.swift"), "utf8"); + const pinned = manifest.match(/ericdahl-dev\/ShowKit", exact: "([^"]+)"/)?.[1]; + if (pinned !== CONFIRMED_AT) + throw new Error(`ShowRecorder pins ShowKit ${pinned}, but website/tests/showKit.ts was confirmed at ${CONFIRMED_AT}: see that file.`); + return COPIED; +}