Last active
August 11, 2023 20:10
-
-
Save ThiagoBarradas/b66eeb1271e696a1a76cbdd98fae251d to your computer and use it in GitHub Desktop.
CodeClimate - send dotnet code coverage
This file contains 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
# Download codeclimate test reporter | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./codeclimate-test-reporter | |
chmod +x ./codeclimate-test-reporter | |
# Install dotnet tools to generate test report | |
dotnet tool install --global coverlet.console | |
dotnet add package coverlet.msbuild | |
# Start codeclimate process | |
./codeclimate-test-reporter before-build | |
# Build solution | |
dotnet restore | |
dotnet build ./MySolution.sln | |
# Running unit tests - 'lcov' output format (and put coverage in correct path) | |
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=coverage /p:Exclude=[xunit.*]* ./MySolution.sln | |
mkdir coverage && mv ./MyProject.Tests/coverage.info coverage/lcov.info | |
# Send test report result to codeclimate | |
./codeclimate-test-reporter after-build -t lcov -r ${CC_TEST_REPORTER_ID} -p ./ --exit-code $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment