1+ os : Visual Studio 2017
2+
3+ skip_tags : false
4+
5+ configuration : Release
6+
7+ init :
8+ - ps : |
9+ If ($($env:APPVEYOR_REPO_TAG) -eq "true") {
10+ $env:RELEASE_VERSION = $env:APPVEYOR_REPO_TAG_NAME
11+ }
12+ else {
13+ $env:RELEASE_VERSION = "0.0.0-ci.sha.$($env:APPVEYOR_REPO_COMMIT.Substring(0, 7)).build.$env:APPVEYOR_BUILD_NUMBER"
14+ }
15+
16+ Update-AppveyorBuild -Version $env:RELEASE_VERSION
17+
18+ install :
19+ - ps : |
20+ Write-Host "STARTED installing code coverage tools" -ForegroundColor Magenta
21+
22+ choco install opencover.portable
23+
24+ choco install codecov
25+
26+ Write-Host "FINISHED installing code coverage tools" -ForegroundColor Magenta
27+
28+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
29+
30+ dotnet_csproj :
31+ patch : true
32+ file : ' src\$(APPVEYOR_PROJECT_NAME)\$(APPVEYOR_PROJECT_NAME).csproj'
33+ version : ' $(RELEASE_VERSION)'
34+
35+ before_build :
36+ - ps : |
37+ Write-Host "STARTED restoring project dependencies" -ForegroundColor Magenta
38+
39+ dotnet restore -v m
40+
41+ Write-Host "FINISHED restoring project dependencies" -ForegroundColor Magenta
42+
43+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
44+
45+ build_script :
46+ - ps : |
47+ Write-Host "STARTED building project" -ForegroundColor Magenta
48+
49+ dotnet build -c $env:CONFIGURATION --no-restore -v m
50+
51+ Write-Host "FINISHED building project" -ForegroundColor Magenta
52+
53+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
54+
55+ after_build :
56+ - ps : |
57+ Write-Host "STARTED verifying strong name" -ForegroundColor Magenta
58+
59+ $sn = "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7 Tools\sn.exe"
60+
61+ foreach ($assembly in ls "src\$env:APPVEYOR_PROJECT_NAME\bin\$env:CONFIGURATION\*\$env:APPVEYOR_PROJECT_NAME.dll") {
62+ &$sn -vf $assembly
63+
64+ if ($LastExitCode -ne 0) { Break }
65+ }
66+
67+ Write-Host "FINISHED verifying strong name" -ForegroundColor Magenta
68+
69+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
70+
71+ - ps : |
72+ Write-Host "STARTED creating NuGet package" -ForegroundColor Magenta
73+
74+ dotnet pack src\$env:APPVEYOR_PROJECT_NAME -c $env:CONFIGURATION --no-restore --no-build --include-symbols --output ..\..\artifacts -v m
75+
76+ Write-Host "FINISHED creating NuGet package" -ForegroundColor Magenta
77+
78+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
79+
80+ test_script :
81+ - ps : |
82+ Write-Host "STARTED running unit tests" -ForegroundColor Magenta
83+
84+ dotnet test test\$env:APPVEYOR_PROJECT_NAME.Tests -c $env:CONFIGURATION --no-restore --no-build -v m
85+
86+ Write-Host "FINISHED running unit tests" -ForegroundColor Magenta
87+
88+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
89+
90+ after_test :
91+ - ps : |
92+ Write-Host "STARTED generating code coverage report" -ForegroundColor Magenta
93+
94+ dotnet build -c $env:CONFIGURATION --no-restore -v m /p:codecov=true
95+
96+ OpenCover.Console.exe -target:"$env:XUNIT20\xunit.console.x86.exe" -targetargs:"test\$env:APPVEYOR_PROJECT_NAME.Tests\bin\$env:CONFIGURATION\net471\$env:APPVEYOR_PROJECT_NAME.Tests.dll -noshadow" -register:user -filter:"+[*]* -[$env:APPVEYOR_PROJECT_NAME.Tests]*" -hideskipped:All -output:".\coverage.xml"
97+
98+ Write-Host "FINISHED generating code coverage report" -ForegroundColor Magenta
99+
100+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
101+
102+ - ps : |
103+ Write-Host "STARTED uploading code coverage report" -ForegroundColor Magenta
104+
105+ codecov -f coverage.xml
106+
107+ Write-Host "FINISHED uploading code coverage report" -ForegroundColor Magenta
108+
109+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
110+
111+ artifacts :
112+ - path : artifacts\$(APPVEYOR_PROJECT_NAME).$(RELEASE_VERSION).nupkg
113+ - path : artifacts\$(APPVEYOR_PROJECT_NAME).$(RELEASE_VERSION).symbols.nupkg
114+
115+ deploy :
116+ provider : NuGet
117+ api_key :
118+ secure : +0GZhozUx/pj7Dn0mIlAgFAEYz45uuEbdqH/2/VGNVtsL1GJDRB64qOmCx/tnWR
119+ skip_symbols : false
120+ artifact : /.*\.nupkg/
121+ on :
122+ appveyor_repo_tag : true
0 commit comments