Skip to content

feat: v1.1.1 #32

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

Merged
merged 1 commit into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# 1.1.1

- docs: README and metadata updates
- feat: improve failure message

# 1.1.0

- feat: added support to exclude files

```yaml
uses: VGVentures/very-good-coverage@v1.1.0
uses: VeryGoodOpenSource/very_good_coverage@v1.1.0
with:
path: "./coverage/lcov.info"
min_coverage: 95
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
## Example usage

```yaml
uses: VeryGoodOpenSource/[email protected].0
uses: VeryGoodOpenSource/[email protected].1
with:
path: "./coverage/lcov.info"
min_coverage: 95
Expand Down
28 changes: 14 additions & 14 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/sourcemap-register.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
const core = require("@actions/core");
const minimatch = require("minimatch");
const parse = require("lcov-parse");
const core = require('@actions/core');
const minimatch = require('minimatch');
const parse = require('lcov-parse');

function run() {
const lcovPath = core.getInput("path");
const minCoverage = core.getInput("min_coverage");
const excluded = core.getInput("exclude");
const excludedFiles = excluded.split(" ");
const lcovPath = core.getInput('path');
const minCoverage = core.getInput('min_coverage');
const excluded = core.getInput('exclude');
const excludedFiles = excluded.split(' ');

parse(lcovPath, function (_, data) {
if (typeof data === "undefined") {
core.setFailed("parsing error!");
parse(lcovPath, (_, data) => {
if (typeof data === 'undefined') {
core.setFailed('parsing error!');
return;
}
let totalFinds = 0;
let totalHits = 0;
data.forEach(element => {
if (shouldCalculateCoverageForFile(element["file"], excludedFiles)) {
data.forEach((element) => {
if (shouldCalculateCoverageForFile(element['file'], excludedFiles)) {
totalHits += element['lines']['hit'];
totalFinds += element['lines']['found'];
}
});
const coverage = (totalHits / totalFinds) * 100;
const isValidBuild = coverage >= minCoverage;
if (!isValidBuild) {
core.setFailed(`Coverage ${coverage} is below the minimum ${minCoverage} expected`);
core.setFailed(`${coverage} is less than min_coverage ${minCoverage}`);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "very-good-coverage",
"version": "1.1.0",
"version": "1.1.1",
"description": "A Github Action which helps enforce code coverage threshold using lcov",
"main": "index.js",
"scripts": {
Expand Down