Skip to content

Commit

Permalink
chore: Reporting Code Coverage to Codecov (aws-amplify#5168)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruisebas authored May 15, 2024
1 parent c3d73be commit 30c4245
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/workflows/report-code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Report Code Coverage

on:
push:
branches: [ main ]

jobs:
unit-tests:
name: All SDK Unit Tests
runs-on: macos-latest
continue-on-error: true
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Run AWS SDK Unit Tests
run: xcodebuild test -project AWSiOSSDKv2.xcodeproj -scheme AWSAllUnitTests -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' -derivedDataPath Build/ -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
- name: Generate SDK Coverage Report
run: |
cd Build/Build/ProfileData
cd $(ls -d */|head -n 1)
pathCoverage=${{ github.workspace }}/Build/Build/ProfileData/${PWD##*/}/Coverage.profdata
devicePath=${{ github.workspace }}/Build/Build/Products/Debug-iphonesimulator
cd $devicePath
for FRAMEWORK in $(basename -a -s .framework -- *.framework)
do
echo "Generating coverage report for $FRAMEWORK..."
xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage $devicePath/$FRAMEWORK.framework/$FRAMEWORK >> aws-sdk-ios-Coverage.lcov
done
mv aws-sdk-ios-Coverage.lcov ${{ github.workspace }}
- name: Run AWS Auth SDK Unit Tests
run: xcodebuild test -project AWSAuthSDK/AWSAuthSDK.xcodeproj -scheme AWSMobileClient -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' -derivedDataPath Build/ -enableCodeCoverage YES -only-testing:"AWSMobileClientUnitTests" | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
- name: Generate Auth SDK Coverage Report
run: |
cd Build/Build/ProfileData
cd $(ls -d */|head -n 1)
pathCoverage=Build/Build/ProfileData/${PWD##*/}/Coverage.profdata
cd ${{ github.workspace }}
echo "Generating coverage report for AWSMobileClient..."
xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage Build/Build/Products/Debug-iphonesimulator/AWSAuthSDKTestApp.app/Frameworks/AWSMobileClient.framework/AWSMobileClient >> aws-sdk-ios-Coverage.lcov
- name: Upload Coverage Report
uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0
with:
flags: AWS-SDK
token: ${{ secrets.CODECOV_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -402,6 +403,56 @@
ReferencedContainer = "container:AWSiOSSDKv2.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "211FFCEC26C306E000F0DB75"
BuildableName = "AWSChimeSDKIdentityUnitTests.xctest"
BlueprintName = "AWSChimeSDKIdentityUnitTests"
ReferencedContainer = "container:AWSiOSSDKv2.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "211FFCDD26C3069900F0DB75"
BuildableName = "AWSChimeSDKMessagingUnitTests.xctest"
BlueprintName = "AWSChimeSDKMessagingUnitTests"
ReferencedContainer = "container:AWSiOSSDKv2.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2109E54A2547557A0057043C"
BuildableName = "AWSLocationUnitTests.xctest"
BlueprintName = "AWSLocationUnitTests"
ReferencedContainer = "container:AWSiOSSDKv2.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FAFFD94C2334292000E2317C"
BuildableName = "AWSCoreConfigurationTest.xctest"
BlueprintName = "AWSCoreConfigurationTest"
ReferencedContainer = "container:AWSiOSSDKv2.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FAFFD95B2334293B00E2317C"
BuildableName = "AWSCoreServiceConfigurationTest.xctest"
BlueprintName = "AWSCoreServiceConfigurationTest"
ReferencedContainer = "container:AWSiOSSDKv2.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# AWS SDK for iOS

[![Release](https://img.shields.io/github/release/aws/aws-sdk-ios.svg)](../../releases)
[![Code Coverage](https://codecov.io/gh/aws-amplify/aws-sdk-ios/branch/main/graph/badge.svg)](https://codecov.io/gh/aws-amplify/aws-sdk-ios)
[![CocoaPods](https://img.shields.io/cocoapods/v/AWSCore.svg)](https://cocoapods.org/pods/AWSCore)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Integration Test](https://github.com/aws-amplify/aws-sdk-ios/actions/workflows/integ-test.yml/badge.svg)](https://github.com/aws-amplify/aws-sdk-ios)
Expand Down
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
codecov:
branch: main

coverage:
status:
patch: off
project:
default:
threshold: 1%

0 comments on commit 30c4245

Please sign in to comment.