diff --git a/Package.resolved b/Package.resolved index f4733dcc5..f786a3744 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "ec77bc40677bd20f99d813dea09781e534f4cb4539fb504b27d997b95f98d6d0", + "originHash" : "eb16f7bcd7ef32b27433d7e2ee4cd129ad3c29e854c62696900658127333c78e", "pins" : [ { "identity" : "pkl-swift", @@ -64,6 +64,15 @@ "version" : "1.6.5" } }, + { + "identity" : "xcresultparser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/a7ex/xcresultparser", + "state" : { + "revision" : "95ca65d0bd56250ccd16331f5b0480a1a2c0c5e9", + "version" : "2.2.0" + } + }, { "identity" : "yams", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index adfa86b2b..5b08772ec 100644 --- a/Package.swift +++ b/Package.swift @@ -10,7 +10,8 @@ var dependencies: [Package.Dependency] = [ // .package(path: "../../../swift-command-line-tools"), .package(url: "https://github.com/swiftlang/swift-subprocess", .upToNextMinor(from: "0.3.0")), .package(url: "https://github.com/jpsim/Yams", .upToNextMinor(from: "6.2.2")), - .package(url: "https://github.com/apple/swift-log", .upToNextMinor(from: "1.10.1")) + .package(url: "https://github.com/apple/swift-log", .upToNextMinor(from: "1.10.1")), + .package(url: "https://github.com/a7ex/xcresultparser", .upToNextMinor(from: "2.2.0")) ] if FileManager.default.fileExists(atPath: "Enterprise/Pipeline/Package.swift") { @@ -33,7 +34,8 @@ let package = Package( .product(name: "CommandLineTools", package: "swift-command-line-tools"), .product(name: "Subprocess", package: "swift-subprocess"), .product(name: "Yams", package: "Yams"), - .product(name: "Logging", package: "swift-log") + .product(name: "Logging", package: "swift-log"), + .product(name: "XcresultparserLib", package: "xcresultparser") ], path: "Tools/Sources", swiftSettings: [ diff --git a/Tools/Sources/Commands/CI/CI.swift b/Tools/Sources/Commands/CI/CI.swift index d0678b14b..01a6c8cf1 100644 --- a/Tools/Sources/Commands/CI/CI.swift +++ b/Tools/Sources/Commands/CI/CI.swift @@ -1,6 +1,7 @@ import ArgumentParser import Foundation import Subprocess +import XcresultparserLib import Yams struct CI: ParsableCommand { @@ -75,7 +76,11 @@ struct CI: ParsableCommand { } do { - try await run(.path("/bin/zsh"), ["-cu", "xcresultparser -q -o cobertura -t \(target) -p \(projectPath) \(resultBundlePath) > \(outputPath)"]) + let converter = try CoberturaCoverageConverter(with: URL(filePath: resultBundlePath), + projectRoot: projectPath, + coverageTargets: [target], + strictPathnames: false) + try converter.xmlString(quiet: true).write(toFile: outputPath, atomically: true, encoding: .utf8) logger.info("\nšŸ“Š Coverage report: \(outputPath)\n") } catch { logger.error("\nāŒ Failed to collect coverage for \(resultBundle): \(error.localizedDescription)\n") @@ -95,7 +100,8 @@ struct CI: ParsableCommand { } do { - try await run(.path("/bin/zsh"), ["-cu", "xcresultparser -q -o junit -p \(projectPath) \(resultBundlePath) > \(outputPath)"]) + let junitXML = try JunitXML(with: URL(filePath: resultBundlePath), projectRoot: projectPath) + try junitXML.xmlString.write(toFile: outputPath, atomically: true, encoding: .utf8) logger.info("šŸ“‹ Test results: \(outputPath)") } catch { logger.error("\nāŒ Failed to collect test results for \(resultBundle): \(error.localizedDescription)\n") diff --git a/ci_scripts/ci_common.sh b/ci_scripts/ci_common.sh index da43fdf4e..9f64819fc 100755 --- a/ci_scripts/ci_common.sh +++ b/ci_scripts/ci_common.sh @@ -15,7 +15,7 @@ setup_github_actions_environment() { unset HOMEBREW_NO_INSTALL_FROM_API export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 - brew update && brew install xcodegen swiftlint swiftformat git-lfs pkl a7ex/homebrew-formulae/xcresultparser + brew update && brew install xcodegen swiftlint swiftformat git-lfs pkl } setup_github_actions_translations_environment() { @@ -30,7 +30,7 @@ setup_github_actions_translations_environment() { } xcode_select_for_github_actions() { - # We need to select it globally for other processes like xcresultparser and our custom tools to use the same Xcode version. + # We need to select it globally for our custom tools to use the same Xcode version. sudo xcode-select -s /Applications/Xcode_26.5.0.app }