Description
It looks to me that codecov.io/bash script lacks support for uploading code coverage for Swift packages. I had not found any information regarding that on this forum, thus I decided to ask.
- Did anyone try to upload code coverage for Swift packages?
- Are there any plans to support them?
Repository
I run my experiments on the following repository, branch feature/swift_package_conversion.
https://github.com/wnagrodzki/SwiftLogger/tree/feature/swift_package_conversion
Versions
Safari Version 13.0.3 (15608.3.10.1.4). macOS Catalina 10.15.1 (19B88).
Additional Information
I tried passing .build/debug/codecov
as directory to search for coverage reports, but the script did not find any.
$ curl --silent https://codecov.io/bash | bash -s -- -s .build/debug/codecov/
_____ _
/ ____| | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| | __/ (_| (_) \ V /
\_____\___/ \__,_|\___|\___\___/ \_/
Bash-8a28df4
==> Travis CI detected.
project root: .
Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
+ .build/debug/codecov/
--> No coverage report found.
Please visit http://docs.codecov.io/docs/supported-languages
Testing package and printing code coverage
I confirmed it is possible to test Swift package and gather code coverage data.
- Clone the repository and checkout feature/swift_package_conversion branch
- Run unit tests and generate code coverage files
$ swift test --enable-code-coverage
- Print code coverage
$ xcrun llvm-cov report .build/debug/SwiftLoggerPackageTests.xctest/Contents/MacOS/SwiftLoggerPackageTests -instr-profile .build/debug/codecov/default.profdata
Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sources/SwiftLogger/LogStringConvertible.swift 2 0 100.00% 2 0 100.00% 6 0 100.00%
Sources/SwiftLogger/Logger.swift 14 0 100.00% 5 0 100.00% 24 0 100.00%
Sources/SwiftLogger/Loggers/AgregateLogger.swift 5 0 100.00% 3 0 100.00% 9 0 100.00%
Sources/SwiftLogger/Loggers/ConsoleLogger.swift 2 2 0.00% 2 2 0.00% 8 8 0.00%
Sources/SwiftLogger/Loggers/DiskLogger/DiskLogger.swift 22 4 81.82% 11 4 63.64% 91 12 86.81%
Sources/SwiftLogger/Loggers/DiskLogger/Logrotate.swift 11 0 100.00% 5 0 100.00% 26 0 100.00%
Sources/SwiftLogger/Loggers/DiskLogger/OSFileHandle.swift 20 20 0.00% 4 4 0.00% 30 30 0.00%
Sources/SwiftLogger/Loggers/DiskLogger/OSFileManager.swift 2 2 0.00% 2 2 0.00% 6 6 0.00%
Sources/SwiftLogger/Loggers/DiskLogger/SizeLimitedFile.swift 5 0 100.00% 3 0 100.00% 17 0 100.00%
Sources/SwiftLogger/Loggers/NullLogger.swift 3 3 0.00% 3 3 0.00% 8 8 0.00%
Tests/SwiftLoggerTests/AgregateLoggerTests.swift 13 0 100.00% 13 0 100.00% 31 0 100.00%
Tests/SwiftLoggerTests/DiskLoggerTests.swift 51 3 94.12% 39 3 92.31% 176 9 94.89%
Tests/SwiftLoggerTests/LogStringConvertibleTests.swift 10 0 100.00% 10 0 100.00% 21 0 100.00%
Tests/SwiftLoggerTests/LoggetTests.swift 22 1 95.45% 22 1 95.45% 37 1 97.30%
Tests/SwiftLoggerTests/LogrotateTests.swift 41 4 90.24% 41 4 90.24% 142 11 92.25%
Tests/SwiftLoggerTests/SizeLimitedFileTests.swift 24 2 91.67% 24 2 91.67% 67 2 97.01%
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL 247 41 83.40% 189 25 86.77% 699 87 87.55%