Skip to content

Commit 8118b5f

Browse files
refactor/updatetestsuite (#103)
* Refactored code into framework for better teset maintenance * Import @testable MiddleDrag replaced with MiddleDragCore * Update project configuration and test suite for improved functionality * Add test plan and update project configuration for improved testing * Fix: Remove redundant TestableReference from test scheme to prevent hangs * Update deployment target to 11.5 and correct file type for test plan * Refactor: Change access level of performRestart and shouldLogToSentry for improved encapsulation * Fix: Update testMainActorIsolatedCallsDoNotDeadlock to skip in CI to prevent hangs * Fix: Add SKIP_INSTALL to prevent lsregister hangs and implement timeout for CI builds * Fix: Remove timeout from CI build command to prevent unnecessary failures * Refactor: Update project structure by removing outdated framework extraction documentation and adjusting test suite for improved concurrency handling * Enhancement: Implement safeguards in MouseEventGenerator and DeviceMonitor to prevent hangs in CI environments and improve thread safety in multitouch operations * Enhancement: Add safeguard in createTouchData to handle zero-touch cases, preventing potential dereferencing issues. * Enhancement: Implement deinitializer in MenuBarController to ensure proper cleanup of status item on deallocation * Enhancement: Modify setUp method in MenuBarControllerTests to skip UI tests in headless CI environments, improving test reliability. * Enhancement: Add checks in MouseEventGenerator to avoid CGEvent calls in headless CI environments, preventing potential hangs during mouse location retrieval. * Refactor: Remove the Build step from the CI workflow to streamline the process and focus on running tests with coverage. * Enhancement: Enable unsafe multitouch and CGEvent tests in the CI workflow, and update test methods to conditionally skip based on environment variables, improving test flexibility and reliability. * Refactor: Remove environment variables for unsafe multitouch and CGEvent tests in the CI workflow, simplifying the test configuration and enhancing clarity. * Enhancement: Update CI workflow to skip app registration with Launch Services and set a timeout for the build and test job, improving stability and preventing hangs during execution. * Enhancement: Update Xcode build command in CI workflow to disable parallel testing and limit workers to one, preventing hangs during DeviceMonitor/Multitouch tests. * Enhancement: Add check in AppDelegate to skip app bootstrap during unit/integration tests, improving test execution flow and preventing unnecessary initialization. * Refactor: Improve deinitializer in MenuBarController to safely remove status item on deallocation, ensuring proper cleanup on both main and background threads. * Refactor: Update MenuBarController to encapsulate status item in a struct for improved memory management and safety during deinitialization, ensuring proper cleanup on both main and background threads. Additionally, modify Xcode project settings to enable Objective-C header installation and adjust build script for debug symbol uploads. * Enhancement: Add main thread checks in MouseEventGenerator to prevent AppKit screen API calls from background queues in CI environments, ensuring stability and avoiding potential hangs during mouse location retrieval. * Refactor: Improve lifecycle lock management in DeviceMonitor to prevent blocking during cleanup operations, ensuring smoother start/stop transitions and enhancing thread safety. * Enhancement: Introduce a new method in MouseEventGenerator to safely read mouse location using AppKit on the main thread, ensuring thread safety and improving fallback handling for Quartz coordinates.
1 parent b1dcbdd commit 8118b5f

37 files changed

Lines changed: 773 additions & 333 deletions

.github/actions/xcodebuild/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ runs:
5050
# Determine if running tests or building
5151
if [ "${{ inputs.run-tests }}" == "true" ]; then
5252
XCODE_CMD="$XCODE_CMD test"
53+
# DeviceMonitor/Multitouch tests use shared global state; parallel workers can hang/flap.
54+
XCODE_CMD="$XCODE_CMD -parallel-testing-enabled NO"
55+
XCODE_CMD="$XCODE_CMD -maximum-parallel-testing-workers 1"
5356
else
5457
XCODE_CMD="$XCODE_CMD build"
5558
fi
@@ -65,6 +68,10 @@ runs:
6568
XCODE_CMD="$XCODE_CMD CODE_SIGNING_REQUIRED=NO"
6669
XCODE_CMD="$XCODE_CMD CODE_SIGNING_ALLOWED=NO"
6770
71+
# Skip install/registration paths on CI to prevent lsregister hangs
72+
XCODE_CMD="$XCODE_CMD SKIP_INSTALL=YES"
73+
XCODE_CMD="$XCODE_CMD REGISTER_APP_WITH_LAUNCH_SERVICES=NO"
74+
6875
# Optional: Coverage
6976
if [ "${{ inputs.enable-coverage }}" == "true" ]; then
7077
XCODE_CMD="$XCODE_CMD -enableCodeCoverage YES"

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
2323
name: Build & Test with Coverage
2424
runs-on: macos-latest
25+
timeout-minutes: 30
2526

2627
steps:
2728
- name: Checkout
@@ -32,11 +33,6 @@ jobs:
3233
with:
3334
xcode-version: latest-stable
3435

35-
- name: Build
36-
uses: ./.github/actions/xcodebuild
37-
with:
38-
configuration: Debug
39-
4036
- name: Run Tests with Coverage
4137
uses: ./.github/actions/xcodebuild
4238
with:

0 commit comments

Comments
 (0)