From 00f2dac9d999e7c2128f7fc2959e5115e7112e22 Mon Sep 17 00:00:00 2001 From: Server Cimen <505984+servercimen@users.noreply.github.com> Date: Thu, 19 Nov 2026 19:54:33 -0800 Subject: [PATCH 1/2] Add CI: package tests and iOS builds No CI ran the tests or built the apps in the repository. The workflow runs on pushes to main and on pull requests. One job runs swift test on macOS. The other builds the package, the demo app, the chat sample and the benchmark app for iOS, without code signing. Refs #11. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e96ba68 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Package tests on macOS + runs-on: macos-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Show the Xcode version + run: xcodebuild -version + - name: Run the tests + run: swift test + + build-ios: + name: iOS builds + runs-on: macos-latest + timeout-minutes: 45 + steps: + - uses: actions/checkout@v4 + - name: Show the Xcode version + run: xcodebuild -version + - name: Build the package + run: > + xcodebuild build -scheme TranscriptKit -destination 'generic/platform=iOS' + CODE_SIGNING_ALLOWED=NO + - name: Build the demo app + run: > + xcodebuild build -project Demo/TranscriptDemo.xcodeproj -scheme TranscriptDemo + -destination 'generic/platform=iOS' -skipMacroValidation CODE_SIGNING_ALLOWED=NO + - name: Build the chat sample + run: > + xcodebuild build -project Examples/ChatSample/ChatSample.xcodeproj -scheme ChatSample + -destination 'generic/platform=iOS' -skipMacroValidation CODE_SIGNING_ALLOWED=NO + - name: Build the benchmark app + run: > + xcodebuild build -project Benchmark/TranscriptBench.xcodeproj -scheme TranscriptBench + -destination 'generic/platform=iOS' -skipMacroValidation CODE_SIGNING_ALLOWED=NO From 8e684f2f80b5d73b9255fe146fd3ccff4f8ecdfb Mon Sep 17 00:00:00 2001 From: Server Cimen <505984+servercimen@users.noreply.github.com> Date: Thu, 19 Nov 2026 20:03:18 -0800 Subject: [PATCH 2/2] Turn on the parser cross-check under Swift Testing without XCTest checksSettledResult was on only when the XCTestCase class was loaded. With Xcode 26.6, swift test runs Swift Testing tests without loading XCTest, so the cross-check was off and settledResultIsCheckedInTests failed on CI. A loaded .xctest bundle, or an .xctest path in the runner's arguments, now also turns it on. Neither is there in an app. Refs #11. Co-Authored-By: Claude Opus 5.5 --- Sources/TranscriptKit/Markdown/InlineParser.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Sources/TranscriptKit/Markdown/InlineParser.swift b/Sources/TranscriptKit/Markdown/InlineParser.swift index 739366c..f87cb7c 100644 --- a/Sources/TranscriptKit/Markdown/InlineParser.swift +++ b/Sources/TranscriptKit/Markdown/InlineParser.swift @@ -128,9 +128,14 @@ enum InlineParser { } /// Whether every parse also rebuilds its whole result and checks that the - /// settled part matches. On only when the test framework is loaded: in an - /// app's debug build it would double the cost of every parse. - static let checksSettledResult = NSClassFromString("XCTestCase") != nil + /// settled part matches. On only under a test runner: in an app's debug + /// build it would double the cost of every parse. Swift Testing can run + /// without loading XCTest, so a loaded `.xctest` bundle also counts. + static let checksSettledResult: Bool = { + if NSClassFromString("XCTestCase") != nil { return true } + if Bundle.allBundles.contains(where: { $0.bundlePath.hasSuffix(".xctest") }) { return true } + return ProcessInfo.processInfo.arguments.contains { $0.hasSuffix(".xctest") || $0.contains(".xctest/") } + }() /// Parses a whole string. static func parse(_ source: String, open: Bool, tags: [String: TranscriptTag] = [:]) -> Result {