@@ -288,12 +288,29 @@ jobs:
288288 echo "::warning::Swift Testing framework not found in Package.swift dependencies"
289289 fi
290290
291- # Test compilation with Swift Testing import
292- echo 'import Testing; @Test func check() { #expect(true) }' > /tmp/testing_check.swift
293- if xcrun swift -I $(xcrun --show-sdk-path)/usr/lib/swift -c -o /tmp/testing_check /tmp/testing_check.swift 2>/dev/null; then
294- echo "✅ Swift Testing framework compilation test passed"
291+ # Test compilation with Swift Testing import in the context of the project
292+ echo "Testing Swift Testing framework compilation with project context..."
293+ cat > /tmp/testing_check.swift << 'EOF'
294+ import Testing
295+
296+ @Test func basicSwiftTestingCheck() {
297+ # expect(true)
298+ }
299+
300+ @Test("Test with description")
301+ func namedTest() {
302+ # expect(1 + 1 == 2)
303+ }
304+ EOF
305+
306+ # Try to compile with the project's build context
307+ if swift package resolve && xcrun swift -package-path . -I .build/debug -c -o /tmp/testing_check /tmp/testing_check.swift 2>/dev/null; then
308+ echo "✅ Swift Testing framework compilation test passed with project context"
309+ elif xcrun swift -c -o /tmp/testing_check /tmp/testing_check.swift 2>/dev/null; then
310+ echo "✅ Swift Testing framework compilation test passed with basic context"
295311 else
296- echo "::warning::Swift Testing framework compilation test failed - may affect test execution"
312+ echo "::warning::Swift Testing framework compilation test failed - may impact test execution but not critical"
313+ echo "::warning::This is expected if Swift Testing is only available in the Xcode build context"
297314 fi
298315
299316 # Clean up
@@ -310,8 +327,9 @@ jobs:
310327
311328 # Run main app tests with Swift Testing support
312329 echo "Running main app tests via xcodebuild..."
330+ MAIN_TEST_EXIT_CODE=0
313331 set -o pipefail
314- xcodebuild test \
332+ if ! xcodebuild test \
315333 -workspace CodeLooper.xcworkspace \
316334 -scheme CodeLooper \
317335 -destination "platform=macOS" \
@@ -321,29 +339,50 @@ jobs:
321339 OTHER_SWIFT_FLAGS="-enable-testing" \
322340 CODE_SIGN_IDENTITY="" \
323341 CODE_SIGNING_REQUIRED=NO \
324- CODE_SIGNING_ALLOWED=NO | xcbeautify || echo "::warning::Some main app tests failed"
342+ CODE_SIGNING_ALLOWED=NO | xcbeautify; then
343+ MAIN_TEST_EXIT_CODE=$?
344+ echo "::warning::Main app tests failed with exit code $MAIN_TEST_EXIT_CODE"
345+ else
346+ echo "✅ Main app tests completed successfully"
347+ fi
325348
326349 # Check if test results were generated
327350 if [ -d "test-results/CodeLooper.xcresult" ]; then
328351 echo "✅ Test results bundle created successfully"
329352 # Extract basic test summary
353+ echo "Test results summary:"
330354 xcrun xcresulttool get --format json --path test-results/CodeLooper.xcresult | head -20 || true
331355 else
332356 echo "::warning::No test results bundle was created"
333357 fi
334358
335- # Run subpackage tests with Swift Testing framework
336- echo "Running AXorcist tests..."
359+ # Run subpackage tests (these use XCTest, not Swift Testing)
360+ echo "::group::Running Subpackage Tests"
361+
362+ echo "Running AXorcist tests (XCTest-based)..."
337363 cd AXorcist
338- swift test --enable-code-coverage --verbose || echo "::warning::AXorcist tests failed"
364+ if swift test --enable-code-coverage 2>&1 | tee ../test-results/axorcist-output.log; then
365+ echo "✅ AXorcist tests completed"
366+ else
367+ echo "::warning::AXorcist tests failed - see log output above"
368+ echo "Note: AXorcist uses XCTest framework which may have integration test dependencies"
369+ fi
339370 cd ..
340371
341372 echo "Running DesignSystem tests..."
342- cd DesignSystem
343- swift test --enable-code-coverage --verbose || echo "::warning::DesignSystem tests failed"
373+ cd DesignSystem
374+ if swift test --enable-code-coverage --verbose 2>&1 | tee ../test-results/designsystem-output.log; then
375+ echo "✅ DesignSystem tests completed"
376+ else
377+ echo "::warning::DesignSystem tests failed - see log output above"
378+ fi
344379 cd ..
345380
346381 echo "::endgroup::"
382+ echo "::endgroup::"
383+
384+ # Summary
385+ echo "Test execution completed. Main tests exit code: $MAIN_TEST_EXIT_CODE"
347386
348387 - name : Build, Sign, and Optionally Notarize macOS App
349388 id : build_sign_notarize_step
0 commit comments