-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ci): add coverage reports to sonar and github #65
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
Open
etiennej70
wants to merge
15
commits into
main
Choose a base branch
from
ci/tests_coverage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4f8ac79
feat(ci): add coverage reports to sonar and github
etiennej70 beb7f76
fix(conar): fix the sonar scanner url
etiennej70 fcec697
fix(ci): fix shell error
etiennej70 921c452
fix(sonar): upgrade sonar scanner
etiennej70 6d03bc2
fix(sonar): upgrade sonar org
etiennej70 8e2d963
fix(sonar): change cobertura converter
etiennej70 414dae3
fix(coverage): change the conversion script. Improve security in CI
etiennej70 d5ccce6
fix(ci): fix build
etiennej70 7f48d2c
fix(ci): fix report conversion
etiennej70 9d136cd
fix(security): fix permissions scope in ci
etiennej70 81551d9
fix(lint): fix pom lint
etiennej70 c8f29aa
fix(ci): fix report conversion
etiennej70 cac28cc
fix(ci): fix report conversion
etiennej70 fa513dc
fix(ci): fix report conversion
etiennej70 d8369d8
fix(ci): fix report conversion
etiennej70 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
| <xsl:output method="xml" indent="yes" encoding="UTF-8"/> | ||
|
|
||
| <!-- Entry point: delegate to <report> template --> | ||
| <xsl:template match="/"> | ||
| <xsl:apply-templates select="report"/> | ||
| </xsl:template> | ||
|
|
||
| <!-- Root coverage element with global counters --> | ||
| <xsl:template match="report"> | ||
| <xsl:variable name="coveredLines" select="sum(counter[@type='LINE']/@covered)"/> | ||
| <xsl:variable name="missedLines" select="sum(counter[@type='LINE']/@missed)"/> | ||
| <xsl:variable name="coveredBranches" select="sum(counter[@type='BRANCH']/@covered)"/> | ||
| <xsl:variable name="missedBranches" select="sum(counter[@type='BRANCH']/@missed)"/> | ||
| <xsl:variable name="totalLines" select="$coveredLines + $missedLines"/> | ||
| <xsl:variable name="totalBranches" select="$coveredBranches + $missedBranches"/> | ||
| <coverage> | ||
| <xsl:attribute name="line-rate"> | ||
| <xsl:choose> | ||
| <xsl:when test="$totalLines > 0"> | ||
| <xsl:value-of select="$coveredLines div $totalLines"/> | ||
| </xsl:when> | ||
| <xsl:otherwise>1</xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:attribute> | ||
| <xsl:attribute name="branch-rate"> | ||
| <xsl:choose> | ||
| <xsl:when test="$totalBranches > 0"> | ||
| <xsl:value-of select="$coveredBranches div $totalBranches"/> | ||
| </xsl:when> | ||
| <xsl:otherwise>1</xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:attribute> | ||
| <xsl:attribute name="lines-covered"><xsl:value-of select="$coveredLines"/></xsl:attribute> | ||
| <xsl:attribute name="lines-valid"><xsl:value-of select="$totalLines"/></xsl:attribute> | ||
| <xsl:attribute name="branches-covered"><xsl:value-of select="$coveredBranches"/></xsl:attribute> | ||
| <xsl:attribute name="branches-valid"><xsl:value-of select="$totalBranches"/></xsl:attribute> | ||
| <xsl:attribute name="complexity">0</xsl:attribute> | ||
| <xsl:attribute name="version">0.1</xsl:attribute> | ||
| <xsl:attribute name="timestamp">0</xsl:attribute> | ||
| <sources> | ||
| <source>.</source> | ||
| </sources> | ||
| <packages> | ||
| <xsl:apply-templates select="package"/> | ||
| </packages> | ||
| </coverage> | ||
| </xsl:template> | ||
|
|
||
| <!-- Package element --> | ||
| <xsl:template match="package"> | ||
| <xsl:variable name="coveredLines" select="sum(counter[@type='LINE']/@covered)"/> | ||
| <xsl:variable name="missedLines" select="sum(counter[@type='LINE']/@missed)"/> | ||
| <xsl:variable name="coveredBranches" select="sum(counter[@type='BRANCH']/@covered)"/> | ||
| <xsl:variable name="missedBranches" select="sum(counter[@type='BRANCH']/@missed)"/> | ||
| <xsl:variable name="totalLines" select="$coveredLines + $missedLines"/> | ||
| <xsl:variable name="totalBranches" select="$coveredBranches + $missedBranches"/> | ||
| <package> | ||
| <xsl:attribute name="name"><xsl:value-of select="translate(@name, '/', '.')"/></xsl:attribute> | ||
| <xsl:attribute name="line-rate"> | ||
| <xsl:choose> | ||
| <xsl:when test="$totalLines > 0"><xsl:value-of select="$coveredLines div $totalLines"/></xsl:when> | ||
| <xsl:otherwise>1</xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:attribute> | ||
| <xsl:attribute name="branch-rate"> | ||
| <xsl:choose> | ||
| <xsl:when test="$totalBranches > 0"><xsl:value-of select="$coveredBranches div $totalBranches"/></xsl:when> | ||
| <xsl:otherwise>1</xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:attribute> | ||
| <xsl:attribute name="complexity">0</xsl:attribute> | ||
| <classes> | ||
| <xsl:apply-templates select="class"/> | ||
| </classes> | ||
| </package> | ||
| </xsl:template> | ||
|
|
||
| <!-- Class element — line-rate from the class counters; line details from the | ||
| corresponding sourcefile element (same package, same filename) --> | ||
| <xsl:template match="class"> | ||
| <xsl:variable name="sname" select="@sourcefilename"/> | ||
| <xsl:variable name="sf" select="../sourcefile[@name=$sname]"/> | ||
| <xsl:variable name="coveredLines" select="sum(counter[@type='LINE']/@covered)"/> | ||
| <xsl:variable name="missedLines" select="sum(counter[@type='LINE']/@missed)"/> | ||
| <xsl:variable name="coveredBranches" select="sum(counter[@type='BRANCH']/@covered)"/> | ||
| <xsl:variable name="missedBranches" select="sum(counter[@type='BRANCH']/@missed)"/> | ||
| <xsl:variable name="totalLines" select="$coveredLines + $missedLines"/> | ||
| <xsl:variable name="totalBranches" select="$coveredBranches + $missedBranches"/> | ||
| <class> | ||
| <xsl:attribute name="name"><xsl:value-of select="translate(@name, '/', '.')"/></xsl:attribute> | ||
| <xsl:attribute name="filename"><xsl:value-of select="concat(../@name, '/', @sourcefilename)"/></xsl:attribute> | ||
| <xsl:attribute name="line-rate"> | ||
| <xsl:choose> | ||
| <xsl:when test="$totalLines > 0"><xsl:value-of select="$coveredLines div $totalLines"/></xsl:when> | ||
| <xsl:otherwise>1</xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:attribute> | ||
| <xsl:attribute name="branch-rate"> | ||
| <xsl:choose> | ||
| <xsl:when test="$totalBranches > 0"><xsl:value-of select="$coveredBranches div $totalBranches"/></xsl:when> | ||
| <xsl:otherwise>1</xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:attribute> | ||
| <xsl:attribute name="complexity">0</xsl:attribute> | ||
| <methods> | ||
| <xsl:apply-templates select="method"/> | ||
| </methods> | ||
| <lines> | ||
| <xsl:apply-templates select="$sf/line"/> | ||
| </lines> | ||
| </class> | ||
| </xsl:template> | ||
|
|
||
| <!-- Method element --> | ||
| <xsl:template match="method"> | ||
| <xsl:variable name="coveredLines" select="sum(counter[@type='LINE']/@covered)"/> | ||
| <xsl:variable name="missedLines" select="sum(counter[@type='LINE']/@missed)"/> | ||
| <xsl:variable name="coveredBranches" select="sum(counter[@type='BRANCH']/@covered)"/> | ||
| <xsl:variable name="missedBranches" select="sum(counter[@type='BRANCH']/@missed)"/> | ||
| <xsl:variable name="totalLines" select="$coveredLines + $missedLines"/> | ||
| <xsl:variable name="totalBranches" select="$coveredBranches + $missedBranches"/> | ||
| <method> | ||
| <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> | ||
| <xsl:attribute name="signature"><xsl:value-of select="@desc"/></xsl:attribute> | ||
| <xsl:attribute name="line-rate"> | ||
| <xsl:choose> | ||
| <xsl:when test="$totalLines > 0"><xsl:value-of select="$coveredLines div $totalLines"/></xsl:when> | ||
| <xsl:otherwise>1</xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:attribute> | ||
| <xsl:attribute name="branch-rate"> | ||
| <xsl:choose> | ||
| <xsl:when test="$totalBranches > 0"><xsl:value-of select="$coveredBranches div $totalBranches"/></xsl:when> | ||
| <xsl:otherwise>1</xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:attribute> | ||
| <xsl:attribute name="complexity">0</xsl:attribute> | ||
| </method> | ||
| </xsl:template> | ||
|
|
||
| <!-- Sourcefile line element: maps nr→number, ci→hits, mb/cb→branch info --> | ||
| <xsl:template match="line"> | ||
| <line> | ||
| <xsl:attribute name="number"><xsl:value-of select="@nr"/></xsl:attribute> | ||
| <xsl:attribute name="hits"><xsl:value-of select="@ci"/></xsl:attribute> | ||
| <xsl:choose> | ||
| <xsl:when test="(@mb + @cb) > 0"> | ||
| <xsl:attribute name="branch">true</xsl:attribute> | ||
| <xsl:attribute name="condition-coverage"> | ||
| <xsl:value-of select="round(100 * @cb div (@mb + @cb))"/> | ||
| <xsl:text>% (</xsl:text> | ||
| <xsl:value-of select="@cb"/> | ||
| <xsl:text>/</xsl:text> | ||
| <xsl:value-of select="@mb + @cb"/> | ||
| <xsl:text>)</xsl:text> | ||
| </xsl:attribute> | ||
| </xsl:when> | ||
| <xsl:otherwise> | ||
| <xsl:attribute name="branch">false</xsl:attribute> | ||
| </xsl:otherwise> | ||
| </xsl:choose> | ||
| </line> | ||
| </xsl:template> | ||
|
|
||
| </xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,4 +42,4 @@ jobs: | |
| - name: Install dependencies | ||
| working-directory: docs | ||
| run: | | ||
| uv sync | ||
| uv sync --no-build --frozen | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [actionlint] reported by reviewdog 🐶
unknown permission scope "code-quality". all available permission scopes are "actions", "artifact-metadata", "attestations", "checks", "contents", "deployments", "discussions", "id-token", "issues", "models", "packages", "pages", "pull-requests", "repository-projects", "security-events", "statuses" [permissions]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
False positive 😢