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: adds codecov to CI pipeline and coverage badge to README #261

Merged
merged 5 commits into from Mar 5, 2021

Conversation

thawkin3
Copy link
Contributor

@thawkin3 thawkin3 commented Mar 4, 2021

I've added Codecov to the CI Pipeline so that the GitHub Actions workflow will run the unit tests with the coverage report and then pipe the results over to Codecov. I also added a code coverage badge to the README so that we can show off the awesome coverage.

I based my changes off of these two previous MRs in the focus-trap-react repo:

Closes #260

PR Checklist

Please leave this checklist in your PR.

  • Source changes maintain stated browser compatibility.
  • Issue being fixed is referenced.
  • Unit test coverage added/updated.
  • E2E test coverage added/updated.
  • Typings added/updated.
  • README updated (API changes, instructions, etc.).
  • Changes to dependencies explained.
  • Changeset added (run yarn changeset locally to add one, and follow the prompts).

@changeset-bot
Copy link

changeset-bot bot commented Mar 4, 2021

⚠️ No Changeset found

Latest commit: fd184e5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link

codecov bot commented Mar 4, 2021

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #261   +/-   ##
=========================================
  Coverage          ?   93.38%           
=========================================
  Files             ?        1           
  Lines             ?      257           
  Branches          ?       66           
=========================================
  Hits              ?      240           
  Misses            ?       16           
  Partials          ?        1           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c569855...fd184e5. Read the comment docs.

Copy link

@maraisr maraisr left a comment

Choose a reason for hiding this comment

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

Solid effort mate, thank you so much! Just one comment about the coverage commands.

package.json Outdated
@@ -65,6 +67,7 @@
"brfs": "^2.0.2",
"browserify": "^17.0.0",
"budo": "^11.6.4",
"codecov": "^3.8.1",
Copy link

Choose a reason for hiding this comment

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

Rather than include this as a dep, we should just install this in the CI. There zero benefit to ever running this locally.

So can you please do a yarn global add codecov in the gh actions file, and just running that after the tests run. Similarity get rid of line 33 here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Love it, thanks! I'll take care of that soon. On that note, we should probably do the same over in the focus-trap-react repo since it also has codecov listed as a dev dependency: https://github.com/focus-trap/focus-trap-react/blob/master/package.json#L77

I can make the same change over there once we get this MR approved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After a few attempts, I think I finally have this working correctly. The CI pipeline passes anyway. 😅

These two issues helped me resolve the problem of the global yarn package not being installed properly or not being installed where it could be found:

@@ -331,7 +331,7 @@
"@babel/helper-plugin-utils" "^7.13.0"
"@babel/plugin-syntax-logical-assignment-operators" "^7.10.4"

"@babel/plugin-proposal-nullish-coalescing-operator@^7.13.0", "@babel/plugin-proposal-nullish-coalescing-operator@^7.13.8":
"@babel/plugin-proposal-nullish-coalescing-operator@^7.13.8":
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI: This was the result after I removed the codecov package with yarn remove codecov. I checked for what packages are requiring @babel/plugin-proposal-nullish-coalescing-operator, and it's only @babel/preset-env which does in fact request @babel/plugin-proposal-nullish-coalescing-operator@^7.13.8.

So I believe what we see here is correct, and the fact that there were two versions of this package previously installed was unnecessary and that something had gotten out of sync with the lock file.

@thawkin3 thawkin3 requested a review from maraisr March 5, 2021 04:00
@thawkin3
Copy link
Contributor Author

thawkin3 commented Mar 5, 2021

@maraisr I think this is ready for another round of review whenever you have a minute. Thanks!

@stefcameron
Copy link
Member

👀

Copy link
Member

@stefcameron stefcameron left a comment

Choose a reason for hiding this comment

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

This looks good to me, thank you @thawkin3 ! I'll let @maraisr chime in before merging.

Copy link

@maraisr maraisr left a comment

Choose a reason for hiding this comment

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

Thanks for this one! 🦄

@maraisr maraisr merged commit 7a6f7be into focus-trap:master Mar 5, 2021
@thawkin3 thawkin3 deleted the feature/codecov branch March 5, 2021 23:49
@thawkin3
Copy link
Contributor Author

thawkin3 commented Mar 5, 2021

Thanks guys!

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.

Add code coverage badge to the README
3 participants