75 lines
3.0 KiB
Groovy
75 lines
3.0 KiB
Groovy
pipeline
|
|
{
|
|
agent
|
|
{
|
|
node
|
|
{
|
|
label 'jenkins_homer_agent'
|
|
}
|
|
}
|
|
stages
|
|
{
|
|
stage('Build')
|
|
{
|
|
environment
|
|
{
|
|
dotnet ="C:\\Program Files\\dotnet\\"
|
|
scannerHome = "C:\\home\\jenkins\\tools\\hudson.plugins.sonar.MsBuildSQRunnerInstallation\\C_sonar-runner"
|
|
token = 'sqa_e7db7f1c8b88a3c3aa9bb8146895b83475c15741'
|
|
project = 'hochbaustatistik'
|
|
}
|
|
steps
|
|
{
|
|
cleanWs()
|
|
checkout scm
|
|
bat "dotnet restore Hochbaustatistik\\Hochbaustatistik.sln"
|
|
bat "${scannerHome}\\SonarScanner.MSBuild.exe begin /k:${project} /d:sonar.token=${token} /d:sonar.verbose=true /d:sonar.cs.opencover.reportsPaths=${WORKSPACE}\\coverage.xml"
|
|
bat "\"${tool 'MSBuild17'}\" ${WORKSPACE}\\Hochbaustatistik\\Hochbaustatistik.sln /t:Restore /t:Rebuild /p:Configuration=Debug"
|
|
}
|
|
}
|
|
stage('Test')
|
|
{
|
|
environment
|
|
{
|
|
dotnet ="C:\\Program Files\\dotnet\\"
|
|
}
|
|
steps
|
|
{
|
|
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE')
|
|
{
|
|
bat "dotnet test ${WORKSPACE}\\Hochbaustatistik\\Hochbaustatistik.Testing\\Hochbaustatistik.Testing.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=..\\..\\coverage.xml /p:Exclude=[Scan2Compress.GUI]*%2c[Scan2Compress.Properties]* --no-build"
|
|
}
|
|
}
|
|
}
|
|
stage('SonarQube')
|
|
{
|
|
environment
|
|
{
|
|
scannerHome = "C:\\home\\jenkins\\tools\\hudson.plugins.sonar.MsBuildSQRunnerInstallation\\C_sonar-runner"
|
|
token = 'sqa_e7db7f1c8b88a3c3aa9bb8146895b83475c15741'
|
|
project = 'hochbaustatistik'
|
|
}
|
|
steps
|
|
{
|
|
bat "${scannerHome}\\SonarScanner.MSBuild.exe end /d:sonar.token=${token}"
|
|
}
|
|
}
|
|
stage('Coverage')
|
|
{
|
|
environment
|
|
{
|
|
reportGen = "C:\\Nuget-Packages\\reportgenerator\\5.1.6\\tools\\net6.0\\ReportGenerator.exe"
|
|
}
|
|
steps
|
|
{
|
|
bat "${reportGen} -verbosity:Info -reports:${WORKSPACE}\\coverage.xml -targetdir:${WORKSPACE} -reporttypes:SonarQube;Cobertura;Html"
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
|
|
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/Cobertura.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
|
|
}
|
|
}
|
|
} |