diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index a21e768..626453b 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -14,7 +14,20 @@ jobs: steps: - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Unit test Authenticator on iOS - run: xcodebuild test -scheme Authenticator -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + 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]} + - name: Generate Coverage Report + continue-on-error: true + run: | + cd Build/Build/ProfileData + cd $(ls -d */|head -n 1) + pathCoverage=Build/Build/ProfileData/${PWD##*/}/Coverage.profdata + cd ${{ github.workspace }} + xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage Build/Build/Products/Debug-iphonesimulator/Authenticator.o > Authenticator-Coverage.lcov + - name: Upload Report + uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 + with: + flags: Authenticator + verbose: true unit-test-macos: diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Authenticator.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Authenticator.xcscheme index b9b18cd..2f4e13d 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/Authenticator.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/Authenticator.xcscheme @@ -26,7 +26,8 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> diff --git a/README.md b/README.md index 2903f97..b5cdcc0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Amplify UI Authenticator for SwiftUI -[![GitHub](https://img.shields.io/github/license/aws-amplify/amplify-ui-swift-liveness)](LICENSE) +[![GitHub](https://img.shields.io/github/license/aws-amplify/amplify-ui-swift-authenticator)](LICENSE) +[![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) [![Discord](https://img.shields.io/discord/308323056592486420?logo=discord)](https://discord.gg/jWVbPfC) [![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) [![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) diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..b7c9add --- /dev/null +++ b/codecov.yml @@ -0,0 +1,12 @@ +ignore: + - "**/Views" + - "**/Authenticator.swift" + +codecov: + branch: main + +coverage: + status: + project: + default: + threshold: 1%