Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: enable codecov uploading again #384

Merged
merged 9 commits into from
Sep 19, 2023
Merged
23 changes: 12 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,19 @@ jobs:
with:
lane: 'scan'

# Read generate script file to learn more about this CI step.
- name: Generate code coverage report from .xcresult/
run: ./scripts/generate-code-coverage-report.sh
# https://about.codecov.io/blog/pre-converting-xcresult-files-for-codecov-using-xcresultparser/
- name: Generate code coverage report from .xcresult/ that can be converted to codecov format
run: |
brew tap a7ex/homebrew-formulae && brew install xcresultparser
xcresultparser --output-format cobertura "Customer.io-Package.xcresult" > ".build/coverage.xml"
Comment on lines +44 to +48
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the most important part of this PR. The previous tool that we were using to convert xcresult file into a format that codecov understands was no longer working. So, I went out and tried to find a popular tool that we can depend on into the future.

Because codecov made a blog post that included this tool, it made me feel confident in this tool.


# Disable uploading code coverage for now until we investigate the 500 errors we're getting from Codecov.
# - name: Upload code coverage report
# uses: codecov/codecov-action@v2
# with:
# token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} # not required for public repos, but sometimes uploads fail without it so include it anyway
# fail_ci_if_error: true # fail if upload fails so we can catch it and fix it right away.
# verbose: true
# directory: .build/generated
- name: Upload code coverage report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} # not required for public repos, but sometimes uploads fail without it so include it anyway
files: .build/coverage.xml
fail_ci_if_error: true # fail if upload fails so we can catch it and fix it right away.
verbose: true
Comment on lines +50 to +56
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated action to latest v3 and modified the file path to an up-to-date one.


- name: Upload test report
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let package = Package(
products: [ // externally visible products for clients to install.
// library name is the name given when installing the SDK.
// target name is the name used for `import X`
.library(name: "InternalCommon", targets: ["CioInternalCommon"]),
.library(name: "Tracking", targets: ["CioTracking"]),
.library(name: "MessagingPushAPN", targets: ["CioMessagingPushAPN"]),
.library(name: "MessagingPushFCM", targets: ["CioMessagingPushFCM"]),
Expand Down
9 changes: 8 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@ coverage:
informational: true
project:
default:
informational: true
informational: true

# The file that contains code coverage information may contain coverage for files that we do not want to keep track of.
# Example: We do not want to know the coverage for the Tests/ directory because that does not contain source code of our SDK.
# https://docs.codecov.com/docs/ignoring-paths
ignore:
- "Tests" # ignore code coverage of Test/ files
- "**/*.generated.swift" # Ignore code coverage of generated files.
Comment on lines +21 to +23
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some ignore blocks to make our test coverage data more accurate. These files are not relevant to test coverage so we should ignore them.

56 changes: 0 additions & 56 deletions scripts/generate-code-coverage-report.sh

This file was deleted.