2017-07-16 22:09:26 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
# Exit on any error
|
|
|
|
|
set -e
|
|
|
|
|
|
2017-11-16 01:34:02 +08:00
|
|
|
# Ensure no compile errors in all projects
|
2018-04-03 12:35:32 +08:00
|
|
|
find . -name *.csproj -exec dotnet build {} \;
|
2017-11-16 01:34:02 +08:00
|
|
|
|
2018-05-07 20:53:15 +02:00
|
|
|
# Create the NuGet package
|
|
|
|
|
cd src/KubernetesClient/
|
|
|
|
|
dotnet pack -c Release
|
|
|
|
|
cd ../..
|
|
|
|
|
|
2017-07-16 22:09:26 +02:00
|
|
|
# Execute Unit tests
|
2018-04-05 15:13:45 +10:00
|
|
|
cd tests/KubernetesClient.Tests
|
2018-04-03 12:35:32 +08:00
|
|
|
dotnet restore
|
2019-03-26 00:29:12 +01:00
|
|
|
# Save the test results to a file
|
|
|
|
|
# Collect code coverage of the KuberetsClient assembly, but exclude the
|
|
|
|
|
# auto-generated models from the coverage reports.
|
|
|
|
|
dotnet test \
|
|
|
|
|
-l "trx;LogFileName=KubernetesClient.Tests.xunit.trx" \
|
|
|
|
|
/p:CollectCoverage=true \
|
|
|
|
|
/p:Include="[KubernetesClient]*" \
|
|
|
|
|
/p:Exclude="[KubernetesClient]k8s.Models.*" \
|
|
|
|
|
/p:Exclude="[KubernetesClient]k8s.Internal.*" \
|
|
|
|
|
/p:CoverletOutputFormat="opencover" \
|
|
|
|
|
/p:CoverletOutput="KubernetesClient.Tests.opencover.xml"
|
2018-04-05 15:13:45 +10:00
|
|
|
|
2019-03-26 00:29:12 +01:00
|
|
|
cd ..
|
|
|
|
|
echo Generating Code Coverage reports
|
|
|
|
|
export PATH="$PATH:$HOME/.dotnet/tools"
|
|
|
|
|
export DOTNET_ROOT=$(dirname $(realpath $(which dotnet))) # https://github.com/dotnet/cli/issues/9114#issuecomment-401670622
|
|
|
|
|
dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.0.15
|
2020-03-08 15:57:34 -07:00
|
|
|
reportgenerator "-reports:**/*.opencover*.xml" "-targetdir:coveragereport" "-reporttypes:HTMLInline;Cobertura"
|
2019-03-26 00:29:12 +01:00
|
|
|
|
|
|
|
|
ls coveragereport
|
|
|
|
|
ls coveragereport/Cobertura.xml
|
|
|
|
|
|
|
|
|
|
cd ..
|