Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 8 additions & 3 deletions Sources/TranscriptKit/Markdown/InlineParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading