Skip to content

Commit

Permalink
Ability to ignore files from coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaduffy committed Sep 2, 2019
1 parent 96c8400 commit 4b4ed1c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Currently does not support username/password authentication and presumes you ar

```yaml
- name: Sonarscanner for dotnet
uses: Secbyte/dotnet-sonarscanner@v1.0
uses: Secbyte/dotnet-sonarscanner@v1.1
with:
buildCommand: dotnet build .
testCommand: dotnet test .
Expand All @@ -17,6 +17,7 @@ _Currently does not support username/password authentication and presumes you ar
sonarOrganisation: an-org
verbose: "true"
openCoverPaths: "tests/coverage.opencover.xml"
coverageExclusions: "**test*.cs"
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -51,6 +52,9 @@ verbose:
openCoverPaths:
description: "Path(s) to coverage file(s)"
required: false
coverageExclusions:
description: "Glob(s) for files to exclude from coverage"
required: false
```
## Environment variables
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ inputs:
openCoverPaths:
description: "Path(s) to coverage file(s)"
required: false
coverageExclusions:
description: "Glob(s) for files to exclude from coverage"
required: false

runs:
using: "docker"
Expand All @@ -42,6 +45,7 @@ runs:
- ${{ inputs.sonarOrganisation }}
- ${{ inputs.verbose }}
- ${{ inputs.openCoverPaths }}
- ${{ inputs.coverageExclusions }}

branding:
icon: 'check'
Expand Down
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# sonarOrganisation = $6
# verbose = $7
# openCoverPaths = $8
# coverageExclusions = $9

set -eu

Expand Down Expand Up @@ -44,6 +45,11 @@ then
begin_cmd="$begin_cmd /d:sonar.cs.opencover.reportsPaths=\"$8\""
fi

if [ -n "$9" ]
then
begin_cmd="$begin_cmd /d:sonar.coverage.exclusions=\"$9\""
fi

if [ -n "${SONAR_TOKEN}" ]
then
begin_cmd="$begin_cmd /d:sonar.login=\"${SONAR_TOKEN}\""
Expand Down

0 comments on commit 4b4ed1c

Please sign in to comment.