Skip to content

Commit 4124947

Browse files
authored
CI: Test schemes (#800)
Let's try to separate on-device tests from the core suite (with proper retry, timeout, etc.).
1 parent 3323ba3 commit 4124947

File tree

70 files changed

+237
-229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+237
-229
lines changed

.github/workflows/ci.yaml

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
env:
19-
TESTS: "FunctionTests SDKTests RoomTests PublishDataTests PublishBufferCapturerTests VideoViewTests TrackTests"
19+
TEST_TARGETS: "LiveKitCoreTests LiveKitObjCTests"
20+
TEST_TIMEOUT_MINUTES: 10
21+
TEST_RETRY_ATTEMPTS: 3
2022

2123
jobs:
2224
build-and-test:
@@ -43,11 +45,9 @@ jobs:
4345
- os: macos-15
4446
xcode: 16.4
4547
platform: "iOS Simulator,name=iPhone 16 Pro,OS=18.5"
46-
symbol-graph: true
4748
- os: macos-15
4849
xcode: 16.4
4950
platform: "macOS"
50-
symbol-graph: true
5151
- os: macos-15
5252
xcode: 16.4
5353
platform: "macOS,variant=Mac Catalyst"
@@ -62,9 +62,19 @@ jobs:
6262
- os: macos-26
6363
xcode: latest
6464
platform: "iOS Simulator,name=iPhone 17 Pro,OS=26.0"
65+
symbol-graph: true
66+
- os: macos-26
67+
xcode: latest
68+
platform: "macOS"
69+
symbol-graph: true
6570
- os: macos-26
6671
xcode: latest
6772
platform: "macOS"
73+
asan: true
74+
- os: macos-26
75+
xcode: latest
76+
platform: "macOS"
77+
tsan: true
6878
- os: macos-26
6979
xcode: latest
7080
platform: "macOS,variant=Mac Catalyst"
@@ -103,20 +113,36 @@ jobs:
103113
run: |
104114
set -o pipefail && xcodebuild build-for-testing \
105115
-scheme LiveKit \
106-
-destination 'platform=${{ matrix.platform }}' | xcbeautify --renderer github-actions
116+
-destination 'platform=${{ matrix.platform }}' \
117+
-enableAddressSanitizer ${{ matrix.asan == true && 'YES' || 'NO' }} \
118+
-enableThreadSanitizer ${{ matrix.tsan == true && 'YES' || 'NO' }} \
119+
| xcbeautify --renderer github-actions
107120
108-
# Run all tests in parallel instead of sequentially
109121
- name: Run Tests
110-
run: |
111-
IFS=' ' read -r -a tests <<< "${{ env.TESTS }}"
112-
for test in "${tests[@]}"; do
113-
echo "::group::Running test $test"
114-
set -o pipefail && xcodebuild test-without-building \
115-
-scheme LiveKit \
116-
-destination 'platform=${{ matrix.platform }}' \
117-
-only-testing:LiveKitTests/$test | xcbeautify --renderer github-actions
118-
echo "::endgroup::"
119-
done
122+
uses: nick-fields/retry@v3
123+
with:
124+
timeout_minutes: ${{ env.TEST_TIMEOUT_MINUTES }}
125+
max_attempts: ${{ env.TEST_RETRY_ATTEMPTS }}
126+
command: |
127+
set -euo pipefail
128+
IFS=' ' read -r -a tests <<< "${{ env.TEST_TARGETS }}"
129+
130+
for test in "${tests[@]}"; do
131+
echo "::group::$test"
132+
if ! xcodebuild test-without-building \
133+
-scheme LiveKit \
134+
-destination 'platform=${{ matrix.platform }}' \
135+
-enableAddressSanitizer ${{ matrix.asan == true && 'YES' || 'NO' }} \
136+
-enableThreadSanitizer ${{ matrix.tsan == true && 'YES' || 'NO' }} \
137+
-only-testing:$test \
138+
-parallel-testing-enabled YES \
139+
| xcbeautify --renderer github-actions
140+
then
141+
echo "::error::Test failed: $test"
142+
exit 1
143+
fi
144+
echo "::endgroup::"
145+
done
120146
121147
- name: Build for Release
122148
if: ${{ matrix.symbol-graph }}

LiveKit.xctestplan

Lines changed: 0 additions & 49 deletions
This file was deleted.

Package.swift

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,33 @@ let package = Package(
5353
.enableExperimentalFeature("AccessLevelOnImport"),
5454
]
5555
),
56-
.testTarget(
57-
name: "LiveKitTests",
56+
.target(
57+
name: "LiveKitTestSupport",
5858
dependencies: [
5959
"LiveKit",
6060
.product(name: "JWTKit", package: "jwt-kit"),
61+
],
62+
path: "Tests/LiveKitTestSupport"
63+
),
64+
.testTarget(
65+
name: "LiveKitCoreTests",
66+
dependencies: [
67+
"LiveKit",
68+
"LiveKitTestSupport",
6169
]
6270
),
6371
.testTarget(
64-
name: "LiveKitTestsObjC",
72+
name: "LiveKitAudioTests",
6573
dependencies: [
6674
"LiveKit",
67-
.product(name: "JWTKit", package: "jwt-kit"),
75+
"LiveKitTestSupport",
76+
]
77+
),
78+
.testTarget(
79+
name: "LiveKitObjCTests",
80+
dependencies: [
81+
"LiveKit",
82+
"LiveKitTestSupport",
6883
]
6984
),
7085
],

[email protected]

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,33 @@ let package = Package(
5454
.enableExperimentalFeature("AccessLevelOnImport"),
5555
]
5656
),
57-
.testTarget(
58-
name: "LiveKitTests",
57+
.target(
58+
name: "LiveKitTestSupport",
5959
dependencies: [
6060
"LiveKit",
6161
.product(name: "JWTKit", package: "jwt-kit"),
62+
],
63+
path: "Tests/LiveKitTestSupport"
64+
),
65+
.testTarget(
66+
name: "LiveKitCoreTests",
67+
dependencies: [
68+
"LiveKit",
69+
"LiveKitTestSupport",
6270
]
6371
),
6472
.testTarget(
65-
name: "LiveKitTestsObjC",
73+
name: "LiveKitAudioTests",
6674
dependencies: [
6775
"LiveKit",
68-
.product(name: "JWTKit", package: "jwt-kit"),
76+
"LiveKitTestSupport",
77+
]
78+
),
79+
.testTarget(
80+
name: "LiveKitObjCTests",
81+
dependencies: [
82+
"LiveKit",
83+
"LiveKitTestSupport",
6984
]
7085
),
7186
],

Tests/LiveKitTests/Audio/AudioEngineAvailability.swift renamed to Tests/LiveKitAudioTests/AudioEngineAvailability.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@preconcurrency import AVFoundation
1818
@testable import LiveKit
19-
import XCTest
19+
import LiveKitTestSupport
2020

2121
class AudioEngineAvailabilityTests: LKTestCase {
2222
// Check if audio engine will stop when availability is set to .none,

Tests/LiveKitTests/Audio/AudioEngineObserver.swift renamed to Tests/LiveKitAudioTests/AudioEngineObserver.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@preconcurrency import AVFoundation
1818
@testable import LiveKit
19-
import XCTest
19+
import LiveKitTestSupport
2020

2121
final class TestEngineObserver: AudioEngineObserver, @unchecked Sendable {
2222
var next: (any LiveKit.AudioEngineObserver)?

Tests/LiveKitTests/Audio/AudioEnginePermission.swift renamed to Tests/LiveKitAudioTests/AudioEnginePermission.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@preconcurrency import AVFoundation
1818
@testable import LiveKit
19-
import XCTest
19+
import LiveKitTestSupport
2020

2121
class AudioEnginePermissionTests: LKTestCase {
2222
#if os(iOS) || os(visionOS) || os(tvOS)

Tests/LiveKitTests/AudioEngineTests.swift renamed to Tests/LiveKitAudioTests/AudioEngineTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
@preconcurrency import AVFoundation
1818
@testable import LiveKit
19+
import LiveKitTestSupport
1920
import LiveKitWebRTC
2021
import LKObjCHelpers
21-
import XCTest
2222

2323
class AudioEngineTests: LKTestCase, @unchecked Sendable {
2424
override func tearDown() async throws {}

Tests/LiveKitTests/Audio/AudioManagerTests.swift renamed to Tests/LiveKitAudioTests/AudioManagerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
@preconcurrency import AVFoundation
1818
@testable import LiveKit
19+
import LiveKitTestSupport
1920
import LiveKitWebRTC
20-
import XCTest
2121

2222
class AudioManagerTests: LKTestCase {
2323
// Test legacy audio device module's startLocalRecording().

Tests/LiveKitTests/AudioProcessingTests.swift renamed to Tests/LiveKitAudioTests/AudioProcessingTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Foundation
2020
import LiveKitWebRTC
2121

2222
@testable import LiveKit
23-
import XCTest
23+
import LiveKitTestSupport
2424

2525
class AudioProcessingTests: LKTestCase, AudioCustomProcessingDelegate, @unchecked Sendable {
2626
var _initSampleRate: Double = 0.0

0 commit comments

Comments
 (0)