Skip to content

Commit 24f28b8

Browse files
authored
chore: Reporting Code Coverage to Codecov. (#53)
1 parent 8ba6e63 commit 24f28b8

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

.github/workflows/unit_tests.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,20 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
1616
- name: Unit test Authenticator on iOS
17-
run: xcodebuild test -scheme Authenticator -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
17+
run: xcodebuild test -scheme Authenticator -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' -derivedDataPath Build/ -enableCodeCoverage YES -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Authenticator | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
18+
- name: Generate Coverage Report
19+
continue-on-error: true
20+
run: |
21+
cd Build/Build/ProfileData
22+
cd $(ls -d */|head -n 1)
23+
pathCoverage=Build/Build/ProfileData/${PWD##*/}/Coverage.profdata
24+
cd ${{ github.workspace }}
25+
xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage Build/Build/Products/Debug-iphonesimulator/Authenticator.o > Authenticator-Coverage.lcov
26+
- name: Upload Report
27+
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
28+
with:
29+
flags: Authenticator
30+
verbose: true
1831

1932
unit-test-macos:
2033

.swiftpm/xcode/xcshareddata/xcschemes/Authenticator.xcscheme

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
shouldUseLaunchSchemeArgsEnv = "YES">
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
codeCoverageEnabled = "YES">
3031
<Testables>
3132
<TestableReference
3233
skipped = "NO">

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Amplify UI Authenticator for SwiftUI
22

3-
[![GitHub](https://img.shields.io/github/license/aws-amplify/amplify-ui-swift-liveness)](LICENSE)
3+
[![GitHub](https://img.shields.io/github/license/aws-amplify/amplify-ui-swift-authenticator)](LICENSE)
4+
[![Code Coverage](https://codecov.io/gh/aws-amplify/amplify-ui-swift-authenticator/branch/main/graph/badge.svg)](https://codecov.io/gh/aws-amplify/amplify-ui-swift-authenticator)
45
[![Discord](https://img.shields.io/discord/308323056592486420?logo=discord)](https://discord.gg/jWVbPfC)
56
[![Open Bugs](https://img.shields.io/github/issues/aws-amplify/amplify-ui-swift-authenticator/bug?color=d73a4a&label=bugs)](https://github.com/aws-amplify/amplify-ui-swift-authenticator/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
67
[![Feature Requests](https://img.shields.io/github/issues/aws-amplify/amplify-ui-swift-authenticator/feature-request?color=ff9001&label=feature%20requests)](https://github.com/aws-amplify/amplify-ui-swift-authenticator/issues?q=is%3Aissue+label%3Afeature-request+is%3Aopen)

codecov.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ignore:
2+
- "**/Views"
3+
- "**/Authenticator.swift"
4+
5+
codecov:
6+
branch: main
7+
8+
coverage:
9+
status:
10+
project:
11+
default:
12+
threshold: 1%

0 commit comments

Comments
 (0)