Skip to content

Commit

Permalink
Release v1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
GaelGirodon committed Nov 30, 2024
1 parent 14c20f9 commit d4394e8
Show file tree
Hide file tree
Showing 9 changed files with 184 additions and 128 deletions.
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Please create an issue and wait for a feedback
before submitting a pull request.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## 1.7.0 - 2024-11-30

- Fix (and improve) JaCoCo reports loading
- Update dependencies

## 1.6.0 - 2024-10-14

- Add support for LCOV report format
Expand Down
14 changes: 6 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34234,7 +34234,7 @@ var glob = __nccwpck_require__(7206);
* Returns files matching the glob patterns, sorted by ascending depth
* and name, excluding some common unwanted directories from the search.
* @param {string[]} patterns Glob patterns
* @return {Promise<string[]>} Files sorted by the nearest
* @returns {Promise<string[]>} Files sorted by the nearest
*/
async function globNearest(patterns) {
const safePatterns = [
Expand Down Expand Up @@ -34432,16 +34432,14 @@ async function jacoco_getReports(root) {
for (const f of files) {
core.info(`Load JaCoCo report '${f}'`);
const contents = await external_fs_.promises.readFile(f, { encoding: 'utf8' });
const missedMatches = contents
.match(/(?<=<counter[^>]+type="LINE"[^>]+missed=")[0-9.]+(?=")/);
const coveredMatches = contents
.match(/(?<=<counter[^>]+type="LINE"[^>]+covered=")[0-9.]+(?=")/);
if (!missedMatches?.length || !coveredMatches?.length) {
const counter = contents.slice(-400)
.match(/<counter[^>]+type="LINE"[^>]+>/g)?.at(-1);
const missed = parseInt(counter?.match(/missed="([0-9.]+)"/)?.[1]);
const covered = parseInt(counter?.match(/covered="([0-9.]+)"/)?.[1]);
if (isNaN(missed) || isNaN(covered)) {
core.info('Report is not a valid JaCoCo report');
continue; // Invalid report file, trying the next one
}
const missed = parseInt(missedMatches.slice(-1)[0]);
const covered = parseInt(coveredMatches.slice(-1)[0]);
const coverage = covered * 100 / (covered + missed);
reports.push({ type: 'coverage', data: { coverage } });
break; // Successfully loaded a report file, can return now
Expand Down
Loading

0 comments on commit d4394e8

Please sign in to comment.