-
Notifications
You must be signed in to change notification settings - Fork 3
/
appveyor.yml
85 lines (76 loc) · 3.58 KB
/
appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
image: Visual Studio 2019
version: 1.0.{build}
environment:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
TEST_RESULT: 'TestResult.xml'
TEST_COVERAGE: 'CoverResults.xml'
for:
# configuration for "master" branch, build in Release mode
-
branches:
only:
- master
configuration: Release
# configuration for "development" branch, build in Debug mode
-
branches:
only:
- development
configuration: Debug
# "fall back" configuration for all other branches
# no "branches" section defined
configuration: Debug
dotnet_csproj:
patch: true
file: '**\*.csproj'
version: '{version}'
package_version: '{version}'
assembly_version: '{version}'
file_version: '{version}'
informational_version: '{version}'
install:
- choco install opencover.portable
- choco install "sonarscanner-msbuild-net46" -y
before_build:
- cmd: nuget install NUnit.Console -Version 3.11.1 -OutputDirectory testrunner
- cmd: nuget install NUnit.Runners -Version 3.11.1 -OutputDirectory testrunner
- cmd: nuget sources add -name devexpress -source %DEVEXPRESS_API%
- cmd: nuget restore -verbosity quiet
- cmd: set "JAVA_HOME=C:\Program Files\Java\jdk11"
- cmd: set "PATH=C:\Program Files\Java\jdk11\bin;%PATH%"
- cmd: java -version
- ps: >-
if ($env:APPVEYOR_PULL_REQUEST_NUMBER) {
Write-Host Sonar Scanning PR# $env:APPVEYOR_PULL_REQUEST_NUMBER
SonarScanner.MSBuild.exe begin /key:$env:SONARCLOUD_PROJECT_KEY /o:$env:SONARCLOUD_ORGANIZATION /d:sonar.host.url=$env:SONARCLOUD_URL /d:sonar.login=$env:SONARCLOUD_TOKEN /d:sonar.cs.opencover.reportsPaths=$env:TEST_COVERAGE /d:sonar.cs.nunit.reportsPaths=$env:TEST_RESULT /d:sonar.pullrequest.key=$env:APPVEYOR_PULL_REQUEST_NUMBER /d:sonar.pullrequest.provider=GitHub /d:sonar.pullrequest.github.repository=$env:APPVEYOR_REPO_NAME
} elseif ($env:APPVEYOR_REPO_BRANCH -eq "development" -Or $env:APPVEYOR_REPO_BRANCH -eq "master") {
Write-Host Sonar Scanning branch $env:APPVEYOR_REPO_BRANCH
SonarScanner.MSBuild.exe begin /key:$env:SONARCLOUD_PROJECT_KEY /o:$env:SONARCLOUD_ORGANIZATION /d:sonar.host.url=$env:SONARCLOUD_URL /d:sonar.login=$env:SONARCLOUD_TOKEN /d:sonar.cs.opencover.reportsPaths=$env:TEST_COVERAGE /d:sonar.cs.nunit.reportsPaths=$env:TEST_RESULT /d:sonar.branch.name=$env:APPVEYOR_REPO_BRANCH /d:sonar.pullrequest.github.repository=$env:APPVEYOR_REPO_NAME
nuget sources add -name github -username $env:GITHUB_USER -password $env:GITHUB_TOKEN -source https://nuget.pkg.github.com/RHEAGROUP/index.json
} else {
Write-Host Skipping Sonar Scanning
}
build:
project: DEHPCommon.sln
test_script:
- >
OpenCover.Console.exe
-log:Error
-register
-target:".\testrunner\NUnit.ConsoleRunner.3.11.1\tools\nunit3-console.exe"
-targetargs:"DEHPCommon-tests.nunit --where=""cat!=WebServicesDependent && cat!=AppVeyorExclusion && cat!=OfficeDependent"" --config=%CONFIGURATION%"
-returntargetcode
-hideskipped:All
-output:"%TEST_COVERAGE%"
-filter:"+[DEHP*]* -[*.Tests*]* -[*.Views]*"
-excludebyattribute:*.ExcludeFromCodeCoverageAttribute
after_test:
- ps: >-
if ($env:APPVEYOR_PULL_REQUEST_NUMBER -Or $env:APPVEYOR_REPO_BRANCH -eq "development" -Or $env:APPVEYOR_REPO_BRANCH -eq "master") {
SonarScanner.MSBuild.exe end /d:"sonar.login=$env:SONARCLOUD_TOKEN"
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
nuget setApiKey $env:GITHUB_TOKEN -Source "github" -Verbosity quiet
nuget push "DEHPCommon\bin\Debug\DEHPCommon.$env:APPVEYOR_BUILD_VERSION.nupkg" -Source "github"
}
}