Skip to content

Commit

Permalink
Improve logging (#13)
Browse files Browse the repository at this point in the history
* Improve logging

* Add debug in test

* Fix log

* Switch to new Node

* Maybe fix?
  • Loading branch information
ggilder authored May 24, 2024
1 parent d8011e4 commit f3b0af5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set Node.js 16.x
- name: Set Node.js 21.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 21.x

- name: Install dependencies
run: npm ci
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
COVERAGE_FILE_PATH: "./coverage/lcov.info"
COVERAGE_FORMAT: "lcov"
DEBUG: coverage

- if: github.event_name == 'pull_request' || github.event_name == 'push'
uses: coverallsapp/github-action@v2
Expand Down
10 changes: 8 additions & 2 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.

18 changes: 16 additions & 2 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,27 @@ export async function play(): Promise<void> {
// lcov default
var parsedCov = await parseLCov(COVERAGE_FILE_PATH)
}
core.info('Parsing done')
// Sum up lines.found for each entry in parsedCov
const totalLines = parsedCov.reduce(
(acc, entry) => acc + entry.lines.found,
0
)
const coveredLines = parsedCov.reduce(
(acc, entry) => acc + entry.lines.hit,
0
)
core.info(
`Parsing done. ${parsedCov.length} files parsed. Total lines: ${totalLines}. Covered lines: ${coveredLines}.`
)

// 2. Filter Coverage By File Name
const coverageByFile = filterCoverageByFile(parsedCov)
core.info('Filter done')
if (debugOpts['coverage']) {
core.info(`Coverage: ${JSON.stringify(coverageByFile)}`)
core.info(`Coverage:`)
for (const item of coverageByFile) {
core.info(JSON.stringify(item))
}
}
const githubUtil = new GithubUtil(GITHUB_TOKEN)

Expand Down

0 comments on commit f3b0af5

Please sign in to comment.