-
-
Notifications
You must be signed in to change notification settings - Fork 6
Utilize codecov/codecov-action@v3 #68
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
Changes from all commits
cce17a5
dec7b15
fa9757b
1efba5b
e092f17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ jobs: | |
| runs-on: macOS-11 | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v2 | ||
| uses: actions/checkout@v3 | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is orthogonal to the point of this PR but I noticed warnings in this build and decide to fix them while I was here. |
||
| - name: Bundle Install | ||
| run: bundle install | ||
| - name: Select Xcode Version | ||
|
|
@@ -24,7 +24,7 @@ jobs: | |
| runs-on: macOS-11 | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v2 | ||
| uses: actions/checkout@v3 | ||
| - name: Bundle Install | ||
| run: bundle install | ||
| - name: Select Xcode Version | ||
|
|
@@ -45,7 +45,7 @@ jobs: | |
| fail-fast: false | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v2 | ||
| uses: actions/checkout@v3 | ||
| - name: Bundle Install | ||
| run: bundle install | ||
| - name: Select Xcode Version | ||
|
|
@@ -54,9 +54,6 @@ jobs: | |
| run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }} | ||
| - name: Build and Test Framework | ||
| run: Scripts/build.swift ${{ matrix.platforms }} | ||
| - name: Upload Coverage Reports | ||
| if: success() | ||
| run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }} | ||
|
Comment on lines
-57
to
-59
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was having trouble getting Xcode 11 exporting |
||
| spm-12: | ||
| name: Build Xcode 12 | ||
| runs-on: macOS-11 | ||
|
|
@@ -69,7 +66,7 @@ jobs: | |
| fail-fast: false | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v2 | ||
| uses: actions/checkout@v3 | ||
| - name: Bundle Install | ||
| run: bundle install | ||
| - name: Select Xcode Version | ||
|
|
@@ -78,9 +75,6 @@ jobs: | |
| run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }} | ||
| - name: Build and Test Framework | ||
| run: Scripts/build.swift ${{ matrix.platforms }} | ||
| - name: Upload Coverage Reports | ||
| if: success() | ||
| run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }} | ||
|
Comment on lines
-81
to
-83
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, I was having trouble getting Xcode 12 exporting
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Asking to learn: if we upload multiple coverage reports for the same code like we were doing before, what does that mean in codecov? Does codecov take the union?
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah codecov unions (they call it "merging") them: https://docs.codecov.com/docs/merging-reports |
||
| spm-13: | ||
| name: Build Xcode 13 | ||
| runs-on: macOS-12 | ||
|
|
@@ -93,7 +87,7 @@ jobs: | |
| fail-fast: false | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v2 | ||
| uses: actions/checkout@v3 | ||
| - name: Bundle Install | ||
| run: bundle install | ||
| - name: Select Xcode Version | ||
|
|
@@ -102,15 +96,17 @@ jobs: | |
| run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }} | ||
| - name: Build and Test Framework | ||
| run: Scripts/build.swift ${{ matrix.platforms }} | ||
| - name: Prepare Coverage Reports | ||
| run: ./Scripts/prepare-coverage-reports.sh | ||
| - name: Upload Coverage Reports | ||
| if: success() | ||
| run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }} | ||
| uses: codecov/codecov-action@v3 | ||
| spm-13-swift: | ||
| name: Swift Build Xcode 13 | ||
| runs-on: macOS-12 | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v2 | ||
| uses: actions/checkout@v3 | ||
| - name: Bundle Install | ||
| run: bundle install | ||
| - name: Select Xcode Version | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/bin/zsh -l | ||
| set -e | ||
|
|
||
| function exportlcov() { | ||
| build_type=$1 | ||
| executable_name=$2 | ||
|
|
||
| executable=$(find "${directory}" -type f -name $executable_name) | ||
| profile=$(find "${directory}" -type f -name 'Coverage.profdata') | ||
| output_file_name="$executable_name.lcov" | ||
|
|
||
| can_proceed=true | ||
| if [[ $build_type == watchOS* ]]; then | ||
| echo "\tAborting creation of $output_file_name – watchOS not supported." | ||
| elif [[ -z $profile ]]; then | ||
| echo "\tAborting creation of $output_file_name – no profile found." | ||
| elif [[ -z $executable ]]; then | ||
| echo "\tAborting creation of $output_file_name – no executable found." | ||
|
Comment on lines
+13
to
+18
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we fail in these cases?
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not necessarily. Since I put |
||
| else | ||
| output_dir=".build/artifacts/$build_type" | ||
| mkdir -p $output_dir | ||
|
|
||
| output_file="$output_dir/$output_file_name" | ||
| echo "\tExporting $output_file" | ||
| xcrun llvm-cov export -format="lcov" $executable -instr-profile $profile > $output_file | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trying to make sure I follow: how did we get this report before and why do we need to get it differently now?
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before we were using codecov's bash uploader to create this script for us. That script is deprecated. The new system fails to find the Basically, the new system's Xcode support is lacking, so I created a file type it understood natively.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I missed that comment since it was on an outdated line. Thanks for the pointer 👍
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All good – I should have re-applied that comment! |
||
| fi | ||
| } | ||
|
|
||
| for directory in $(git rev-parse --show-toplevel)/.build/derivedData/*/; do | ||
| build_type=$(basename $directory) | ||
| echo "Finding coverage information for $build_type" | ||
|
|
||
| exportlcov $build_type 'CacheAdvanceTests' | ||
| exportlcov $build_type 'CADCacheAdvanceTests' | ||
| done | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,30 +98,17 @@ public final class __ObjectiveCCompatibleCacheAdvanceWithGenericData: NSObject { | |
| /// A decoder that treats all messages as if they are `Data`. | ||
| final class PassthroughDataDecoder: MessageDecoder { | ||
| func decode<T>(_ type: T.Type, from data: Data) throws -> T where T : Decodable { | ||
| if let data = data as? T { | ||
| return data | ||
| } else { | ||
| throw DecodingError.dataCorrupted( | ||
| DecodingError.Context( | ||
| codingPath: [], | ||
| debugDescription: "Type was not Data")) | ||
| } | ||
| // Force cast because this type is only used with a CacheAdvance<Data> type. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it would be programmer error if someone used
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would. That type is internal to the repo so there's not much chance of that happening. |
||
| return data as! T | ||
| } | ||
| } | ||
|
|
||
| // MARK: - PassthroughDataDecoder | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Old copy/paste! |
||
| // MARK: - PassthroughDataEncoder | ||
|
|
||
| /// A encoder that treats all messages as if they are `Data`. | ||
| final class PassthroughDataEncoder: MessageEncoder { | ||
| func encode<T>(_ value: T) throws -> Data where T : Encodable { | ||
| if let value = value as? Data { | ||
| return value | ||
| } else { | ||
| throw EncodingError.invalidValue( | ||
| value, | ||
| EncodingError.Context( | ||
| codingPath: [], | ||
| debugDescription: "Value was not Data")) | ||
| } | ||
| // Force cast because this type is only used with a CacheAdvance<Data> type. | ||
| return value as! Data | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ import Foundation | |
| /// `[messageSize][data]` | ||
| /// - `messageSize` is a big-endian encoded `MessageSpan` of length `messageSpanStorageLength`. | ||
| /// - `data` is length `messageSize`. | ||
| struct EncodableMessage<T: Codable> { | ||
| struct EncodableMessage<T: Codable, Size: BigEndianHostSwappable> { | ||
|
|
||
| // MARK: Initialization | ||
|
|
||
|
|
@@ -40,7 +40,7 @@ struct EncodableMessage<T: Codable> { | |
| /// The encoded message, prefixed with the size of the message blob. | ||
| func encodedData() throws -> Data { | ||
| let messageData = try encoder.encode(message) | ||
| guard messageData.count < MessageSpan.max else { | ||
| guard messageData.count < Size.max else { | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Utilizing a generic here let me run a test where I passed in a message that would throw the error below without that message requiring multiple gigabytes of RAM. |
||
| // We can't encode the length this message in a MessageSpan. | ||
| throw CacheAdvanceError.messageLargerThanCacheCapacity | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,19 +24,14 @@ @implementation SwiftTryCatch | |
| /** | ||
| Provides try catch functionality for swift by wrapping around Objective-C | ||
| */ | ||
| + (void)try:(__attribute__((noescape)) void(^ _Nonnull)(void))try catch:(__attribute__((noescape)) void(^ _Nonnull)(NSException *exception))catch finally:(__attribute__((noescape)) void(^ _Nullable)(void))finally; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume we never used this functionality?
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly. Wasn't used and was lowering our coverage |
||
| + (void)try:(__attribute__((noescape)) void(^ _Nonnull)(void))try catch:(__attribute__((noescape)) void(^ _Nonnull)(NSException *exception))catch; | ||
| { | ||
| @try { | ||
| try(); | ||
| } | ||
| @catch (NSException *exception) { | ||
| catch(exception); | ||
| } | ||
| @finally { | ||
| if (finally != NULL) { | ||
| finally(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,14 @@ comment: | |
| layout: "reach,diff,flags,tree" | ||
| behavior: default | ||
| require_changes: no | ||
|
|
||
| coverage: | ||
| status: | ||
| project: | ||
| default: | ||
| threshold: 0.25% | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This threshold is the same as what we've used in other projects, and it seems reasonable here as well. |
||
| patch: off | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this do? I couldn't find documentation.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| ignore: | ||
| - "Sources/LorumIpsum" | ||
| - "Tests" | ||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting this here so I have a thread. In my PR review I asked:
I am having trouble following what exactly we think fixed the codecov issue ultimately and how we're confident that it's resolved. I'm following up because I want to understand better. Thanks for all of your work here @dfed !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, what fixed the codecov issue was:
lcovfile that codecov could pick up (since the newer version of codecov couldn't find the coverage files in derived data either)Based on the logs from recent builds – the deprecated version of codecov wasn't picking up the
xcresultfile that includes coverage information. I probably could have fixed the issue by manually creating thelcovfile like I did in this MR, but I figured I should start by updating to a non-deprecated tool.You can see from recent logs that we are finding+uploading the
lcovfiles. Looking through other recent builds (all builds are here), you can see the same logs.The very high-level is: codecov was failing to find our coverage data with the old config, and moving to this new config (namely, making the
lcovfiles for codecov rather than making codecov create these files from our derived data) fixed that.I still do not understand why neither the deprecated tool nor the modern tool could create these coverage files given the inputs we were giving them. But at least we have a workaround.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for explaining, and for the log pointer!