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

Code coverage workflow #11617

Merged
merged 3 commits into from
Apr 4, 2022
Merged

Code coverage workflow #11617

merged 3 commits into from
Apr 4, 2022

Conversation

vkarpov15
Copy link
Collaborator

@vkarpov15 vkarpov15 commented Apr 3, 2022

Summary

Fix #11308. We've considered adding a code coverage workflow over the years, but never have because we don't have permissions on the Automattic org to add a tool like Coveralls. However, using GitHub actions, we can upload artifacts associated with a workflow, which means we can at least create an HTML zip of code coverage output on each run. You can then download the zip output from the GitHub workflow summary page. For example, here's the summary page for 405a7f9, here's a screenshot of the output from 405a7f9 after downloading.

image

@Uzlopak

Examples

Copy link
Collaborator

@AbdelrahmanHafez AbdelrahmanHafez left a comment

Choose a reason for hiding this comment

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

LGTM, this is also great for a start.
I think in order to be able to leverage its benefits, we'd need to find a way to make it more accessible.

Ideally, the end result should be a URL easily accessible that serves the HTML from coverage.zip.
Having to download the file, then extracting, then open the HTML file seems like a lot of work and I would probably not check it.

An alternative/addition might be seeing if there is a different data format (JSON?) that we can parse and send to MongoDB as well, and then serving the benchmarks/code coverage stats on a website with cool graphs.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Apr 3, 2022

I wonder if we can directly upload the lcov file to one of the coverage providers?

Not tested Idea:
You own the mongoose org on github. Maybe you create a fake/surrogate repo there and create an account in coveralls and get the coveralls token for that surrogate repo. Then we could upload the lcov file directy to coveralls with
https://www.npmjs.com/package/coveralls by setting the coveralls token

Badge should be also working by pointing to the surrogate project.

@vkarpov15
Copy link
Collaborator Author

Re: uploading lcov directly to Coveralls, I've done so in the past: https://github.com/mongodb-js/connect-mongodb-session/blob/3a27eb1f3722334bd141d6f5abf33d958f36e5f2/.travis.yml . The problem is that we still need a coveralls token: https://www.npmjs.com/package/coveralls#running-locally . Can't upload to Coveralls without first adding the repo to Coveralls, and can't add the repo to Coveralls without your org's permission.

Could always fork to the mongoosejs org, but the problem there is maintaining the fork and causing confusion as to which is the official repo.

I put in a request with Automattic to allow installing Coveralls GitHub app on Automattic's org, we'll see if that works. In the meantime, I'll merge this PR 👍

image

@vkarpov15 vkarpov15 merged commit 258ef84 into master Apr 4, 2022
@hasezoey hasezoey deleted the vkarpov15/gh-11308 branch September 1, 2022 11:23
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 a codecoverage Workflow
3 participants