From 81b20a3e312aa1015a99fc89a0fc49e1e05f1b4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= <nils@piksel.se>
Date: Fri, 13 Jul 2018 18:30:17 +0200
Subject: [PATCH 1/3] Add new appveyor.yml

---
 appveyor.yml | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 appveyor.yml

diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 000000000..12d1736c2
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,73 @@
+version: '{build}'
+image: Visual Studio 2017
+configuration:
+- Debug
+- Release
+dotnet_csproj:
+  patch: true
+  file: '**\*.csproj'
+  version: $(VERSION)
+  package_version: $(VERSION)
+  assembly_version: 1.0.0.999
+  file_version: 1.0.0.999
+  informational_version: $(VERSION)
+install:
+- ps: >-
+    $commit = $(git rev-parse --short HEAD)
+
+    $masterBranches = @("master");
+
+    if ($masterBranches -contains $env:APPVEYOR_REPO_BRANCH) {
+    	$branch = "";
+    } else {
+    	$branch = "-$env:APPVEYOR_REPO_BRANCH";
+    }
+
+    if ($env:APPVEYOR_PULL_REQUEST_NUMBER) {
+    	$suffix = "-pr$env:APPVEYOR_PULL_REQUEST_NUMBER";
+    } else {
+    	$suffix = "";
+    }
+
+    $build = "_${env:APPVEYOR_BUILD_NUMBER}"
+
+    $version = "1.0-git$commit";
+
+    $av_version = "$version$branch$suffix$build";
+    $env:APPVEYOR_BUILD_VERSION=$av_version;
+    $env:VERSION=$version;
+
+    write-host -n "new version: ";
+    write-host -f green $av_version;
+
+    appveyor UpdateBuild -Version $av_version
+nuget:
+  project_feed: true
+  disable_publish_on_pr: true
+before_build:
+- ps: nuget restore ICSharpCode.SharpZipLib.sln
+build:
+  project: ICSharpCode.SharpZipLib.sln
+  publish_nuget: true
+  publish_nuget_symbols: true
+  verbosity: normal
+test_script:
+- ps: >-
+    $proj = ".\test\ICSharpCode.SharpZipLib.TestBootstrapper\ICSharpCode.SharpZipLib.TestBootstrapper.csproj"
+    $resxml = ".\docs\nunit3-test-results-debug.xml"
+
+    # Nuget 3 Console runner:
+    #$tester = "nunit3-console .\test\ICSharpCode.SharpZipLib.Tests\bin\$($env:CONFIGURATION)\netcoreapp2.0\ICSharpCode.SharpZipLib.Tests.dll"
+
+    # Bootstrapper:
+    $tester = "dotnet run -f netcoreapp2 -p $proj -c $env:CONFIGURATION"
+    iex "$tester --explore=tests.xml"
+
+    [xml]$xml = Get-Content("tests.xml")
+    $assembly = select-xml "/test-suite[@type='Assembly']" $xml | select -f 1 -exp Node
+    $testcases = select-xml "//test-case" $xml | % { Add-AppveyorTest -Name $_.Node.fullname -Framework NUnit -Filename $assembly.name }
+
+    iex "$tester --result=$resxml"
+    
+    $wc = New-Object 'System.Net.WebClient'
+    $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit3/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $resxml))

From e687fa2228663821395ae7dba50e978017b979e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= <nils@piksel.se>
Date: Fri, 13 Jul 2018 19:05:35 +0200
Subject: [PATCH 2/3] Add semicolons to avoid appveyor errors

---
 appveyor.yml | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/appveyor.yml b/appveyor.yml
index 12d1736c2..7719bfb4b 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -53,21 +53,21 @@ build:
   verbosity: normal
 test_script:
 - ps: >-
-    $proj = ".\test\ICSharpCode.SharpZipLib.TestBootstrapper\ICSharpCode.SharpZipLib.TestBootstrapper.csproj"
-    $resxml = ".\docs\nunit3-test-results-debug.xml"
+    $proj = ".\test\ICSharpCode.SharpZipLib.TestBootstrapper\ICSharpCode.SharpZipLib.TestBootstrapper.csproj";
+    $resxml = ".\docs\nunit3-test-results-debug.xml";
 
     # Nuget 3 Console runner:
     #$tester = "nunit3-console .\test\ICSharpCode.SharpZipLib.Tests\bin\$($env:CONFIGURATION)\netcoreapp2.0\ICSharpCode.SharpZipLib.Tests.dll"
 
     # Bootstrapper:
-    $tester = "dotnet run -f netcoreapp2 -p $proj -c $env:CONFIGURATION"
-    iex "$tester --explore=tests.xml"
+    $tester = "dotnet run -f netcoreapp2 -p $proj -c $env:CONFIGURATION";
+    iex "$tester --explore=tests.xml";
 
-    [xml]$xml = Get-Content("tests.xml")
-    $assembly = select-xml "/test-suite[@type='Assembly']" $xml | select -f 1 -exp Node
-    $testcases = select-xml "//test-case" $xml | % { Add-AppveyorTest -Name $_.Node.fullname -Framework NUnit -Filename $assembly.name }
+    [xml]$xml = Get-Content("tests.xml");
+    $assembly = select-xml "/test-suite[@type='Assembly']" $xml | select -f 1 -exp Node;
+    $testcases = select-xml "//test-case" $xml | % { Add-AppveyorTest -Name $_.Node.fullname -Framework NUnit -Filename $assembly.name };
 
-    iex "$tester --result=$resxml"
+    iex "$tester --result=$resxml";
     
-    $wc = New-Object 'System.Net.WebClient'
-    $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit3/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $resxml))
+    $wc = New-Object 'System.Net.WebClient';
+    $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit3/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $resxml));

From 9f2c732480deab10f6f224486007091e48ac3dde Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= <nils@piksel.se>
Date: Fri, 13 Jul 2018 19:34:00 +0200
Subject: [PATCH 3/3] Change heredoc type to fix testing

---
 appveyor.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/appveyor.yml b/appveyor.yml
index 7719bfb4b..20bff86e6 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -12,7 +12,7 @@ dotnet_csproj:
   file_version: 1.0.0.999
   informational_version: $(VERSION)
 install:
-- ps: >-
+- ps: |-
     $commit = $(git rev-parse --short HEAD)
 
     $masterBranches = @("master");
@@ -52,7 +52,7 @@ build:
   publish_nuget_symbols: true
   verbosity: normal
 test_script:
-- ps: >-
+- ps: |-
     $proj = ".\test\ICSharpCode.SharpZipLib.TestBootstrapper\ICSharpCode.SharpZipLib.TestBootstrapper.csproj";
     $resxml = ".\docs\nunit3-test-results-debug.xml";
 
