how to generate codeception code coverage badge on github? - github

I'm looking for some automated way to generate a badge with code coverage information in Github repo's README file based on reports created by Codeception. I am aware of hosted services like coverals, but is there a script/library to generate on my own in a travis pipeline?

Related

How can one view line-by-line code coverage in GitHub?

I have a Node.js project, which includes Istanbul, a tool that can generate a code coverage report. I would like to see which lines are not covered and which are covered by tests in my GitHub Pull Requests for this project.
Istanbul allows me to see the coverage locally in the coverage/lcov-report directory, but I would like to see this the "Files Changed" tab of my Pull Requests in GitHub.
There are some tools that provide visual line-by-line coverage:
CodeCov does this, but requires that I upload a coverage report to their servers.
Covaralls does also, but requires that you give them access to your repository.
Jest coverage report uses GitHub actions to add annotations, but cannot add visual indications (e.g. highlighting) of line-by-line test coverage.
Is there any other way to visualize line-by-line test coverage in a GitHub Pull Request?

How to display a VSTS Build Badge in a README.md file hosted on GitHub?

I have developed a tiny library that I chose to host on GitHub. The code is being built by a VSTS build and published as a NuGet package.
I have written a README.md file and I am trying to include a Build badge on it, as described in the Microsoft documentation. Consequently, I have added the following line in the MD file and replaced the placeholders accordindly:
![Build status](https://{my-organisation}.visualstudio.com/{my-project}/_apis/build/status/{my-build-definition-name}?branch=master)
The problem is that the link is not accessible to anyone that is not logged-in on VSTS and I end up with a 'broken' link on my readme page:
Question
What must be done to make the VSTS Build Badge available to a GitHub repo?
I suppose you must include an authentication token of sorts in order to have at least read-access to the VSTS build from your GitHub page.
Note that the documentation lists also multiple pending issues, including MicrosoftDocs/vsts-docs issue 1499:
Build status badge added to GitHub readme doesn't show up.
So this is still in progress.
On that last issue, it says:
This is due to public vs. private projects.
If you make your project public the image URL will render.
There are other potential workarounds we are looking at for the doc.
See "Change the project visibility, public or private".

can SonarQUbe do a full analysis on a github pull request?

I'm looking at integrating Sonarqube with our github instance. the one issue we're having is that SonarQube only supports preview analysis with Github currently, as opposed to a full one that includes code coverage. What we would ideally like is for SonarQube to do a full analysis of each pull request, and then post the outcome of this back to Github as a Github check. Is this possible?

Team Services - Create issue in Github on failed build

I am using Github as my repo as well as my Kanban/Scrum board. We use Visual Studio Team Services for our automated builds. We really like the way VSTS works and it works well with Github as the repo.
However, I want to be able to create a new Github issue/bug if and when our Continuous Integration build fails. I know you can create a VSTS Work Item but I would rather keep all issues centralized.
Is there any way to hook up VSTS to create a Github repo whenever a build fails? Or perhaps create a Github issue whenever a new VSTS Work Item is created?
We are running our own build server so possibly something can be done on that end?
Yes, you can create a github issue when VSTS build failed with two options.
Option1:
In VSTS build definition, add a powershell task in the end of the build process. Functions in the powershell should include:
Detect above build tasks in the build definition. Use REST API timeline to get build detail, you can find each task result in result parameter.
Determine to create a github issue or not. If all above build tasks are pass to build, don’t create github issue. Else, create a github issue by github API.
Option2:
Create your own website, and in VSTS use web hooks to tigger build fail information for your own website. After your own website receive the build information, it can create a github issue.

SonarQube and Github, Travis CI

Is there any way to programmatically check say, using the GitHub API or some API for Travis CI, if a particular project on GitHub or Travis CI uses SonarQube?
Also apart from SonarQube what other program analysis tools do people usually use?
Neither GitHub API nor Travis CI API will be able to provide you with such information - simply because code analysis tools/services are third-party systems that are not built-in features of GitHub or Travis CI.
If you want to "see how many open source projects on GitHub use static program analysis tools", then you would have to browse the source code of each repository to discover some facts that might give you this information (like for instance looking into the .travis.yml file). But because there's no built-in/standard feature on that topic, this would be extremely difficult to correctly achieve this goal IMO.