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

Add codecov #149

Merged
merged 6 commits into from
Aug 11, 2023
Merged

Add codecov #149

merged 6 commits into from
Aug 11, 2023

Conversation

sisyphusSmiling
Copy link
Collaborator

@sisyphusSmiling sisyphusSmiling commented Aug 10, 2023

Closes: #147 #148

Modeled after m-Peter/flow-code-coverage and @m-Peter's PR utilizing Codecov bot.

@sisyphusSmiling sisyphusSmiling marked this pull request as ready for review August 10, 2023 20:43
@@ -23,3 +23,9 @@ jobs:
run: bash -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)" -- v1.3.2
- name: Run tests
run: sh ./test.sh
- name: Normalize coverage report filepaths
run : sh ./normalize_coverage_report.sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this script be checked in somewhere?

Copy link
Collaborator Author

@sisyphusSmiling sisyphusSmiling Aug 10, 2023

Choose a reason for hiding this comment

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

Realized I left that script in the action and just removed it. Having trouble what's going on in that script, but some manipulation of the report is necessary since the last run failed in Codecov on unusable report.

@m-Peter any insights? What is the normalize_coverage_report.sh doing and how would it map to this repo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed, but there's no diff to compare to since this is the first PR with the action.

Copy link
Contributor

Choose a reason for hiding this comment

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

@sisyphusSmiling The LCOV format needs actual file paths, which as of now, it is not yet possible to generate in the code coverage report. This should be fixed with the addition of a sourceFile() pragma: onflow/flow-emulator#437. After I integrate this in the code coverage feature, no normalization/mapping to file paths will be required.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would also suggest a change to the CI workflow, as I have done here:

- name: Install Flow CLI
  run: bash -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)"
- name: Run tests
  run: flow test --cover --covercode="contracts" --coverprofile="coverage.lcov" tests/test_*.cdc

Using the latest available Flow CLI version, and utilizing the --covercode="contracts" flag, which filters out code coverage for scripts & transactions.

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@e8a9bf1). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #149   +/-   ##
=======================================
  Coverage        ?   82.50%           
=======================================
  Files           ?        4           
  Lines           ?      343           
  Branches        ?        0           
=======================================
  Hits            ?      283           
  Misses          ?       60           
  Partials        ?        0           

@sisyphusSmiling sisyphusSmiling requested review from austinkline and a team August 10, 2023 21:52
@sisyphusSmiling
Copy link
Collaborator Author

Thanks so much for the help @m-Peter! I made the updates you advised and I can now see the branch coverage report by file.

@m-Peter
Copy link
Contributor

m-Peter commented Aug 11, 2023

@sisyphusSmiling That looks awesome 🙌

@@ -20,6 +20,12 @@ jobs:
with:
go-version: 1.18
- name: Install Flow CLI
run: bash -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)" -- v1.3.2
Copy link
Collaborator

Choose a reason for hiding this comment

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

heads up, I always pin this because flow versions have broken things for me between minor version in the past. Totally fine to remove, just a heads up that it can cause issues

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good callout. Just pinned to v1.3.4

@sisyphusSmiling sisyphusSmiling merged commit 983cba8 into main Aug 11, 2023
1 check passed
@sisyphusSmiling sisyphusSmiling deleted the add-codecov branch August 11, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update flow.json Mainnet contract aliases
4 participants