Skip to content

Commit ff3abea

Browse files
committed
.appveyor.yml updated
1 parent a8c7912 commit ff3abea

2 files changed

Lines changed: 80 additions & 70 deletions

File tree

.appveyor.yml

Lines changed: 77 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,60 @@ environment:
55
secure: nXDnbkmLZ0yeSj623ZeiGO+be5JhivxxrgiJ9lgHLVH/PKoI52UO2Kt6965QAAM+
66
NUGET_API_KEY:
77
secure: CbJ7DaN2P9YI9zVjNR98Ld3gM0RXqxo91R0wLUO4PcTAVj65mF48vzMNr7JnMppM
8+
SONARQUBE_ORGANIZATION: dotarj-github
9+
SONARQUBE_TOKEN:
10+
secure: zmYFq7/1VpOvb/E+voAXfsRIEuekDH0gpKA89h1V4nH0TqCgKxb8G7ZVPt9mpsBB
11+
SONARQUBE_GITHUB_TOKEN:
12+
secure: R0EXcWv91EY6EVoT7NmIPXxU6ZfqIK0Rhbe2uT9pboQQT99XuVQENS1JE+izE7bI
813

914
image: Visual Studio 2017
1015

1116
skip_tags: false
1217

18+
branches:
19+
only:
20+
- master
21+
1322
configuration: Release
1423

1524
init:
1625
- ps: |
17-
If ($($env:APPVEYOR_REPO_TAG) -eq "true") {
18-
$env:RELEASE_VERSION = $env:APPVEYOR_REPO_TAG_NAME
19-
}
20-
else {
21-
$env:RELEASE_VERSION = "0.0.0-ci.sha.$($env:APPVEYOR_REPO_COMMIT.Substring(0, 7)).build.$env:APPVEYOR_BUILD_NUMBER"
22-
}
26+
function Execute-Action {
27+
param($description, $action)
2328
24-
Update-AppveyorBuild -Version $env:RELEASE_VERSION
29+
Write-Host (Get-Date).ToString("hh:mm:ss.fff") "STARTED $description" -ForegroundColor Magenta
30+
31+
&$action
32+
33+
Write-Host (Get-Date).ToString("hh:mm:ss.fff") "FINISHED $description" -ForegroundColor Magenta
34+
35+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
36+
}
2537
26-
install:
2738
- ps: |
28-
Write-Host "STARTED installing code coverage tools" -ForegroundColor Magenta
39+
Execute-Action "updating build version" {
40+
If ($env:APPVEYOR_REPO_TAG -eq $true) {
41+
$env:RELEASE_VERSION = $env:APPVEYOR_REPO_TAG_NAME
42+
}
43+
else {
44+
$env:RELEASE_VERSION = "0.0.0-ci.sha.$($env:APPVEYOR_REPO_COMMIT.Substring(0, 7)).build.$env:APPVEYOR_BUILD_NUMBER"
45+
}
2946
30-
choco install opencover.portable
47+
Write-Host "Build version:" $env:RELEASE_VERSION -ForegroundColor White
3148
32-
choco install codecov
49+
Update-AppveyorBuild -Version $env:RELEASE_VERSION
50+
}
3351
34-
Write-Host "FINISHED installing code coverage tools" -ForegroundColor Magenta
52+
- ps: |
53+
Execute-Action "updating path variable" {
54+
$env:PATH = $env:PATH + ";C:/Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.7 Tools"
55+
}
3556
36-
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
57+
install:
58+
- ps: |
59+
Execute-Action "installing tools" {
60+
choco install codecov msbuild-sonarqube-runner opencover.portable
61+
}
3762
3863
dotnet_csproj:
3964
patch: true
@@ -42,84 +67,69 @@ dotnet_csproj:
4267

4368
before_build:
4469
- ps: |
45-
Write-Host "STARTED restoring project dependencies" -ForegroundColor Magenta
46-
47-
dotnet restore -v m
48-
49-
Write-Host "FINISHED restoring project dependencies" -ForegroundColor Magenta
70+
Execute-Action "restoring project dependencies" {
71+
dotnet restore -v m
72+
}
5073
51-
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
74+
- ps: |
75+
Execute-Action "beginning code analysis" {
76+
if ($env:APPVEYOR_PULL_REQUEST_NUMBER) {
77+
MSBuild.SonarQube.Runner.exe begin /o:$env:SONARQUBE_ORGANIZATION /k:$env:APPVEYOR_PROJECT_NAME /v:$env:APPVEYOR_BUILD_VERSION /d:sonar.host.url=https://sonarcloud.io /d:sonar.login=$env:SONARQUBE_TOKEN /d:sonar.cs.opencover.reportsPaths=coverage.xml /d:sonar.coverage.exclusions=**/*Tests.cs /d:sonar.github.pullRequest=$env:APPVEYOR_PULL_REQUEST_NUMBER /d:sonar.github.repository=$env:APPVEYOR_REPO_NAME /d:sonar.github.oauth=$env:SONARQUBE_GITHUB_TOKEN
78+
}
79+
else {
80+
MSBuild.SonarQube.Runner.exe begin /o:$env:SONARQUBE_ORGANIZATION /k:$env:APPVEYOR_PROJECT_NAME /v:$env:APPVEYOR_BUILD_VERSION /d:sonar.host.url=https://sonarcloud.io /d:sonar.login=$env:SONARQUBE_TOKEN /d:sonar.cs.opencover.reportsPaths=coverage.xml /d:sonar.coverage.exclusions=**/*Tests.cs
81+
}
82+
}
5283
5384
build_script:
5485
- ps: |
55-
Write-Host "STARTED building project" -ForegroundColor Magenta
56-
57-
dotnet build -c $env:CONFIGURATION --no-restore -v m
58-
59-
Write-Host "FINISHED building project" -ForegroundColor Magenta
60-
61-
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
86+
Execute-Action "building project" {
87+
dotnet build -c $env:CONFIGURATION --no-restore -v m
88+
}
6289
6390
after_build:
6491
- ps: |
65-
If ($($env:VERIFY_STRONG_NAME) -eq "true") {
66-
Write-Host "STARTED verifying strong name" -ForegroundColor Magenta
67-
68-
$sn = "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7 Tools\sn.exe"
92+
If ($env:VERIFY_STRONG_NAME -eq $true) {
93+
Execute-Action "verifying strong name" {
94+
foreach ($assembly in ls "src/$env:APPVEYOR_PROJECT_NAME/bin/$env:CONFIGURATION/*/$env:APPVEYOR_PROJECT_NAME.dll") {
95+
sn.exe -vf $assembly
6996
70-
foreach ($assembly in ls "src\$env:APPVEYOR_PROJECT_NAME\bin\$env:CONFIGURATION\*\$env:APPVEYOR_PROJECT_NAME.dll") {
71-
&$sn -vf $assembly
72-
73-
if ($LastExitCode -ne 0) { Break }
97+
if ($LastExitCode -ne 0) { Break }
98+
}
7499
}
75-
76-
Write-Host "FINISHED verifying strong name" -ForegroundColor Magenta
77-
78-
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
79100
}
80101
81102
- ps: |
82-
Write-Host "STARTED creating NuGet package" -ForegroundColor Magenta
83-
84-
dotnet pack src\$env:APPVEYOR_PROJECT_NAME -c $env:CONFIGURATION --no-restore --no-build --include-symbols --output ..\..\artifacts -v m
85-
86-
Write-Host "FINISHED creating NuGet package" -ForegroundColor Magenta
87-
88-
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
103+
Execute-Action "creating NuGet package" {
104+
dotnet pack src/$env:APPVEYOR_PROJECT_NAME -c $env:CONFIGURATION --no-restore --no-build --include-symbols --output ../../artifacts -v m
105+
}
89106
90107
test_script:
91108
- ps: |
92-
Write-Host "STARTED running unit tests" -ForegroundColor Magenta
93-
94-
dotnet test test\$env:APPVEYOR_PROJECT_NAME.Tests -c $env:CONFIGURATION --no-restore --no-build -v m
95-
96-
Write-Host "FINISHED running unit tests" -ForegroundColor Magenta
97-
98-
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
109+
Execute-Action "running unit tests" {
110+
dotnet test test/$env:APPVEYOR_PROJECT_NAME.Tests -c $env:CONFIGURATION --no-restore --no-build -v m
111+
}
99112
100113
after_test:
101114
- ps: |
102-
Write-Host "STARTED generating code coverage report" -ForegroundColor Magenta
103-
104-
dotnet build -c $env:CONFIGURATION --no-restore -v m /p:codecov=true
105-
106-
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]* -[$env:APPVEYOR_PROJECT_NAME.Samples]*" -hideskipped:All -output:".\coverage.xml"
107-
108-
Write-Host "FINISHED generating code coverage report" -ForegroundColor Magenta
115+
Execute-Action "generating code coverage report" {
116+
dotnet build -c $env:CONFIGURATION --no-restore -v m /p:codecov=true
109117
110-
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
118+
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]* -[$env:APPVEYOR_PROJECT_NAME.Samples]*" -hideskipped:All -output:"./coverage.xml"
119+
}
111120
112121
- ps: |
113-
Write-Host "STARTED uploading code coverage report" -ForegroundColor Magenta
114-
115-
codecov -f coverage.xml
116-
117-
Write-Host "FINISHED uploading code coverage report" -ForegroundColor Magenta
122+
Execute-Action "uploading code coverage report" {
123+
codecov.exe -f coverage.xml
124+
}
118125
119-
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
126+
- ps: |
127+
Execute-Action "ending code analysis" {
128+
MSBuild.SonarQube.Runner.exe end /d:sonar.login=$env:SONARQUBE_TOKEN
129+
}
120130
121131
artifacts:
122-
- path: artifacts\*.nupkg
132+
- path: artifacts/*.nupkg
123133
name: NuGet
124134

125135
deploy:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
[![apache](https://img.shields.io/badge/license-Apache%202-green.svg)](https://raw.githubusercontent.com/dotarj/PartialResponse.AspNetCore.Mvc.Formatters.Json/master/LICENSE)
44
[![nuget](https://img.shields.io/nuget/v/PartialResponse.AspNetCore.Mvc.Formatters.Json.svg)](https://www.nuget.org/packages/PartialResponse.AspNetCore.Mvc.Formatters.Json)
5-
[![myget](https://img.shields.io/myget/partialresponse/v/PartialResponse.AspNetCore.Mvc.Formatters.Json.svg)](https://www.myget.org/feed/partialresponse/package/nuget/PartialResponse.AspNetCore.Mvc.Formatters.Json)
6-
[![Build status](https://ci.appveyor.com/api/projects/status/y8kahoej4avaqwwm?svg=true)](https://ci.appveyor.com/project/dotarj/partialresponse-aspnetcore-mvc-formatters-json)
5+
[![appveyor](https://ci.appveyor.com/api/projects/status/y8kahoej4avaqwwm?svg=true)](https://ci.appveyor.com/project/dotarj/partialresponse-aspnetcore-mvc-formatters-json)
6+
[![sonarqube](https://sonarcloud.io/api/badges/gate?key=PartialResponse.AspNetCore.Mvc.Formatters.Json)](https://sonarcloud.io/dashboard?id=PartialResponse.AspNetCore.Mvc.Formatters.Json)
77
[![codecov](https://codecov.io/gh/dotarj/PartialResponse.AspNetCore.Mvc.Formatters.Json/branch/master/graph/badge.svg)](https://codecov.io/gh/dotarj/PartialResponse.AspNetCore.Mvc.Formatters.Json)
88

99
PartialResponse.AspNetCore.Mvc.Formatters.Json provides JSON partial response (partial resource) support for ASP.NET Core MVC. This package is also [available for ASP.NET Web API](https://github.com/dotarj/PartialResponse/).
@@ -57,6 +57,6 @@ In practice, these rules often allow several different `fields` parameter values
5757
* `fields=items(id,snippet/title,snippet/position)`
5858
* `fields=items(id,snippet(title,position))`
5959

60-
**Note:** As with all query parameter values, the 'fields' parameter value must be URL encoded. For better readability, the examples in this document omit the encoding.
60+
**Note:** As with all query parameter values, the `fields` parameter value must be URL encoded. For better readability, the examples in this document omit the encoding.
6161

6262
**Note:** Due to the relatively slow performance of LINQ to JSON (Json.NET), the usage of PartialJsonOutputFormatter has a performance impact compared to the regular Json.NET serializer. Because of the reduced traffic, the overhead in time could be neglected.

0 commit comments

Comments
 (0)