Skip to content

Commit 7be1bb7

Browse files
authored
chore: Reporting Code Coverage to Codecov (#42)
1 parent aa34c19 commit 7be1bb7

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

.github/workflows/build-and-test.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,29 @@ jobs:
2626
persist-credentials: false
2727

2828
- name: Setup Ruby
29-
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
29+
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0
3030
with:
3131
ruby-version: '3.2.1'
3232
bundler-cache: true
3333

3434
- name: Run unit tests
3535
run: bundle exec fastlane ios tests
3636

37+
- name: Generate Coverage Report
38+
continue-on-error: true
39+
run: |
40+
cd Build/Build/ProfileData
41+
cd $(ls -d */|head -n 1)
42+
pathCoverage=Build/Build/ProfileData/${PWD##*/}/Coverage.profdata
43+
cd ${{ github.workspace }}
44+
xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage Build/Build/Products/Debug-iphonesimulator/AmplifyUtilsNotifications.o > AmplifyUtilsNotifications-Coverage.lcov
45+
46+
- name: Upload Report
47+
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
48+
continue-on-error: true
49+
with:
50+
flags: AmplifyUtilsNotifications
51+
3752
- name: Run integration tests
3853
run: bundle exec fastlane ios integration_tests
3954

@@ -46,7 +61,7 @@ jobs:
4661
persist-credentials: false
4762

4863
- name: Setup Ruby
49-
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
64+
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0
5065
with:
5166
ruby-version: '3.2.1'
5267
bundler-cache: true
@@ -63,7 +78,7 @@ jobs:
6378
persist-credentials: false
6479

6580
- name: Setup Ruby
66-
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
81+
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0
6782
with:
6883
ruby-version: '3.2.1'
6984
bundler-cache: true
@@ -80,7 +95,7 @@ jobs:
8095
persist-credentials: false
8196

8297
- name: Setup Ruby
83-
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
98+
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0
8499
with:
85100
ruby-version: '3.2.1'
86101
bundler-cache: true

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Amplify Swift Utilities for Notifications
22

3+
[![Code Coverage](https://codecov.io/gh/aws-amplify/amplify-swift-utils-notifications/branch/main/graph/badge.svg)](https://codecov.io/gh/aws-amplify/amplify-swift-utils-notifications)
4+
35
Amplify Swift Utilities for Notifications provides helpful functionality for working with push notifications on iOS and macOS.
46

57
Although it was developed for use with AWS Amplify, it can also be used independently.

codecov.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
codecov:
2+
branch: main
3+
4+
coverage:
5+
status:
6+
patch: off
7+
project:
8+
default:
9+
threshold: 1%

fastlane/Fastfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ platform :ios do
1313
package_path: ".",
1414
sdk: "iphonesimulator",
1515
device: "iPhone 14",
16+
derived_data_path: "Build/",
17+
code_coverage: true,
18+
cloned_source_packages_path: "~/Library/Developer/Xcode/DerivedData/AmplifyUtilsNotifications"
1619
)
1720
end
1821

0 commit comments

Comments
 (0)