Skip to content

Commit

Permalink
chore: v1.1.1 (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel authored Nov 10, 2020
1 parent 9767879 commit 03275e9
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 35 deletions.
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

0 comments on commit 03275e9

Please sign in to comment.