Add AppVeyor.yml file (#1417)

* Add AppVeyor.yml file

* Fix casing of Src folder

* Build with official "runbuild.cmd" script

* Add switch for msbuild verbosity

and default it to minimal

* Collect the right nupkg artifact
This commit is contained in:
Andrew Arnott
2017-09-24 13:35:41 +13:00
committed by James Newton-King
parent 5e9f69f59f
commit 5b904ccb0f
2 changed files with 40 additions and 19 deletions
+20
View File
@@ -0,0 +1,20 @@
version: '{build}'
branches:
only:
- master
- /^v\d+(?:\.\d+)?$/
- /[\b_]validate\b/
skip_tags: true
nuget:
disable_publish_on_pr: true
image: Visual Studio 2017
configuration: Release
environment:
VisualStudioVersion: 15.0
init:
git config --global core.autocrlf true
build_script:
- ps: Build\runbuild.ps1
artifacts:
- path: Working\NuGet\*.nupkg
name: NuGet Package
+5 -4
View File
@@ -9,6 +9,7 @@
$signKeyPath = "C:\Development\Releases\newtonsoft.snk" $signKeyPath = "C:\Development\Releases\newtonsoft.snk"
$buildDocumentation = $false $buildDocumentation = $false
$buildNuGet = $true $buildNuGet = $true
$msbuildVerbosity = 'minimal'
$treatWarningsAsErrors = $false $treatWarningsAsErrors = $false
$workingName = if ($workingName) {$workingName} else {"Working"} $workingName = if ($workingName) {$workingName} else {"Working"}
$netCliChannel = "2.0" $netCliChannel = "2.0"
@@ -117,7 +118,7 @@ task Package -depends Build {
$targetFrameworks = ($script:enabledBuilds | Select-Object @{Name="Framework";Expression={$_.Framework}} | select -expand Framework) -join ";" $targetFrameworks = ($script:enabledBuilds | Select-Object @{Name="Framework";Expression={$_.Framework}} | select -expand Framework) -join ";"
exec { & $script:msBuildPath "/t:pack" "/p:IncludeSource=true" "/p:Configuration=Release" "/p:TargetFrameworks=`"$targetFrameworks`"" "$workingSourceDir\Newtonsoft.Json\Newtonsoft.Json.csproj" } exec { & $script:msBuildPath "/t:pack" "/v:$msbuildVerbosity" "/p:IncludeSource=true" "/p:Configuration=Release" "/p:TargetFrameworks=`"$targetFrameworks`"" "$workingSourceDir\Newtonsoft.Json\Newtonsoft.Json.csproj" }
mkdir $workingDir\NuGet mkdir $workingDir\NuGet
move -Path $workingSourceDir\Newtonsoft.Json\bin\Release\*.nupkg -Destination $workingDir\NuGet move -Path $workingSourceDir\Newtonsoft.Json\bin\Release\*.nupkg -Destination $workingDir\NuGet
@@ -135,7 +136,7 @@ task Package -depends Build {
Write-Host "Documentation output to $docOutputPath" Write-Host "Documentation output to $docOutputPath"
# Sandcastle has issues when compiling with .NET 4 MSBuild - http://shfb.codeplex.com/Thread/View.aspx?ThreadId=50652 # Sandcastle has issues when compiling with .NET 4 MSBuild - http://shfb.codeplex.com/Thread/View.aspx?ThreadId=50652
exec { & $script:msBuildPath "/t:Clean;Rebuild" "/p:Configuration=Release" "/p:DocumentationSourcePath=$documentationSourcePath" "/p:OutputPath=$docOutputPath" "$docDir\doc.shfbproj" | Out-Default } "Error building documentation. Check that you have Sandcastle, Sandcastle Help File Builder and HTML Help Workshop installed." exec { & $script:msBuildPath "/t:Clean;Rebuild" "/v:$msbuildVerbosity" "/p:Configuration=Release" "/p:DocumentationSourcePath=$documentationSourcePath" "/p:OutputPath=$docOutputPath" "$docDir\doc.shfbproj" | Out-Default } "Error building documentation. Check that you have Sandcastle, Sandcastle Help File Builder and HTML Help Workshop installed."
move -Path $workingDir\Documentation\LastBuild.log -Destination $workingDir\Documentation.log move -Path $workingDir\Documentation\LastBuild.log -Destination $workingDir\Documentation.log
} }
@@ -170,12 +171,12 @@ function NetCliBuild()
Write-Host -ForegroundColor Green "Restoring packages for $libraryFrameworks in $projectPath" Write-Host -ForegroundColor Green "Restoring packages for $libraryFrameworks in $projectPath"
Write-Host Write-Host
exec { & $script:msBuildPath "/t:restore" "/p:Configuration=Release" "/p:LibraryFrameworks=`"$libraryFrameworks`"" "/p:TestFrameworks=`"$testFrameworks`"" $projectPath | Out-Default } "Error restoring $projectPath" exec { & $script:msBuildPath "/t:restore" "/v:$msbuildVerbosity" "/p:Configuration=Release" "/p:LibraryFrameworks=`"$libraryFrameworks`"" "/p:TestFrameworks=`"$testFrameworks`"" $projectPath | Out-Default } "Error restoring $projectPath"
Write-Host -ForegroundColor Green "Building $libraryFrameworks in $projectPath" Write-Host -ForegroundColor Green "Building $libraryFrameworks in $projectPath"
Write-Host Write-Host
exec { & $script:msBuildPath "/t:build" $projectPath "/p:Configuration=Release" "/p:LibraryFrameworks=`"$libraryFrameworks`"" "/p:TestFrameworks=`"$testFrameworks`"" "/p:AssemblyOriginatorKeyFile=$signKeyPath" "/p:SignAssembly=$signAssemblies" "/p:TreatWarningsAsErrors=$treatWarningsAsErrors" "/p:AdditionalConstants=$additionalConstants" } exec { & $script:msBuildPath "/t:build" "/v:$msbuildVerbosity" $projectPath "/p:Configuration=Release" "/p:LibraryFrameworks=`"$libraryFrameworks`"" "/p:TestFrameworks=`"$testFrameworks`"" "/p:AssemblyOriginatorKeyFile=$signKeyPath" "/p:SignAssembly=$signAssemblies" "/p:TreatWarningsAsErrors=$treatWarningsAsErrors" "/p:AdditionalConstants=$additionalConstants" }
} }
function EnsureNuGetExists() function EnsureNuGetExists()