Skip to content

Commit 997ff5b

Browse files
authored
Merge pull request #14 from adamchester/merge-master-to-dev
Bring back dev branch, re-enable storage emulator tests
2 parents 9f08d3a + d7c2853 commit 997ff5b

14 files changed

+356
-360
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33

4+
.vs/
5+
project.lock.json
6+
47
# User-specific files
58
*.suo
69
*.user
@@ -181,3 +184,4 @@ UpgradeLog*.htm
181184

182185
# Microsoft Fakes
183186
FakesAssemblies/
187+

Build.ps1

Lines changed: 33 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,51 @@
1-
param(
2-
[String] $majorMinor = "0.0", # 2.0
3-
[String] $patch = "0", # $env:APPVEYOR_BUILD_VERSION
4-
[String] $customLogger = "", # C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll
5-
[Switch] $notouch,
6-
[String] $sln # e.g serilog-sink-name
7-
)
8-
9-
function Set-AssemblyVersions($informational, $assembly)
10-
{
11-
(Get-Content assets/CommonAssemblyInfo.cs) |
12-
ForEach-Object { $_ -replace """1.0.0.0""", """$assembly""" } |
13-
ForEach-Object { $_ -replace """1.0.0""", """$informational""" } |
14-
ForEach-Object { $_ -replace """1.1.1.1""", """$assembly""" } |
15-
Set-Content assets/CommonAssemblyInfo.cs
16-
}
1+
echo "build: Build started"
172

18-
function Install-NuGetPackages($solution)
19-
{
20-
nuget restore $solution
21-
}
3+
Push-Location $PSScriptRoot
224

23-
function Invoke-MSBuild($solution, $customLogger)
24-
{
25-
if ($customLogger)
26-
{
27-
msbuild "$solution" /verbosity:minimal /p:Configuration=Release /logger:"$customLogger"
28-
}
29-
else
30-
{
31-
msbuild "$solution" /verbosity:minimal /p:Configuration=Release
32-
}
5+
if(Test-Path .\artifacts) {
6+
echo "build: Cleaning .\artifacts"
7+
Remove-Item .\artifacts -Force -Recurse
338
}
349

35-
function Invoke-NuGetPackProj($csproj)
36-
{
37-
nuget pack -Prop Configuration=Release -Symbols $csproj
38-
}
10+
& dotnet restore --no-cache
3911

40-
function Invoke-NuGetPackSpec($nuspec, $version)
41-
{
42-
nuget pack $nuspec -Version $version -OutputDirectory ..\..\
43-
}
12+
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
13+
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "l" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
14+
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "l"]
4415

45-
function Invoke-NuGetPack($version)
46-
{
47-
ls src/**/*.csproj |
48-
Where-Object { -not ($_.Name -like "*net40*") } |
49-
ForEach-Object { Invoke-NuGetPackProj $_ }
50-
}
16+
echo "build: Version suffix is $suffix"
5117

52-
function Invoke-Build($majorMinor, $patch, $customLogger, $notouch, $sln)
53-
{
54-
$package="$majorMinor.$patch"
55-
$slnfile = "$sln.sln"
18+
foreach ($src in ls src/*) {
19+
Push-Location $src
5620

57-
Write-Output "$sln $package"
21+
echo "build: Packaging project in $src"
5822

59-
if (-not $notouch)
60-
{
61-
$assembly = "$majorMinor.0.0"
23+
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix
24+
if($LASTEXITCODE -ne 0) { exit 1 }
6225

63-
Write-Output "Assembly version will be set to $assembly"
64-
Set-AssemblyVersions $package $assembly
65-
}
26+
Pop-Location
27+
}
28+
29+
foreach ($test in ls test/*.PerformanceTests) {
30+
Push-Location $test
6631

67-
Install-NuGetPackages $slnfile
68-
69-
Invoke-MSBuild $slnfile $customLogger
32+
echo "build: Building performance test project in $test"
7033

71-
Invoke-NuGetPack $package
34+
& dotnet build -c Release
35+
if($LASTEXITCODE -ne 0) { exit 2 }
36+
37+
Pop-Location
7238
}
7339

74-
$ErrorActionPreference = "Stop"
40+
foreach ($test in ls test/*.Tests) {
41+
Push-Location $test
42+
43+
echo "build: Testing project in $test"
7544

76-
if (-not $sln)
77-
{
78-
$slnfull = ls *.sln |
79-
Where-Object { -not ($_.Name -like "*net40*") } |
80-
Select -first 1
45+
& dotnet test -c Release
46+
if($LASTEXITCODE -ne 0) { exit 3 }
8147

82-
$sln = $slnfull.BaseName
48+
Pop-Location
8349
}
8450

85-
Invoke-Build $majorMinor $patch $customLogger $notouch $sln
51+
Pop-Location

appveyor.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
version: '{build}'
2+
skip_tags: true
3+
image: Visual Studio 2015
4+
configuration: Release
5+
install:
6+
- ps: mkdir -Force ".\build\" | Out-Null
7+
- ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1"
8+
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
9+
- ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0-preview2-003121'
10+
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
211
build_script:
3-
- ps: ./Build.ps1 -majorMinor "2.0" -patch "0-beta-$env:APPVEYOR_BUILD_VERSION" -customLogger "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
12+
- ps: ./Build.ps1
13+
test: off
414
artifacts:
5-
- path: Serilog.*.nupkg
15+
- path: artifacts/Serilog.*.nupkg
616
deploy:
717
- provider: NuGet
818
api_key:
919
secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x
20+
skip_symbols: true
1021
on:
1122
branch: /^(master|dev)$/
12-
23+
- provider: GitHub
24+
auth_token:
25+
secure: ggZTqqV1z0xecDoQbeoy3A7xikShCt9FWZIGp95dG9Fo0p5RAT9oGU0ZekHfUIwk
26+
artifact: /Serilog.*\.nupkg/
27+
tag: v$(appveyor_build_version)
28+
on:
29+
branch: master

assets/CommonAssemblyInfo.cs

Lines changed: 0 additions & 5 deletions
This file was deleted.

global.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"projects": [ "src", "test" ],
3+
"sdk": {
4+
"version": "1.0.0-preview2-003121"
5+
}
6+
}

serilog-sinks-azuretablestorage.sln

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.31101.0
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.AzureTableStorage", "src\Serilog.Sinks.AzureTableStorage\Serilog.Sinks.AzureTableStorage.csproj", "{DA0432BD-FDA0-40C9-BCF1-A38F601600D3}"
6+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.AzureTableStorage", "src\Serilog.Sinks.AzureTableStorage\Serilog.Sinks.AzureTableStorage.xproj", "{EDB6E773-0A33-4A88-81BC-3B24ABFEBA61}"
7+
EndProject
8+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.AzureTableStorageWithProperties.Tests", "test\Serilog.Sinks.AzureTableStorageWithProperties.Tests\Serilog.Sinks.AzureTableStorageWithProperties.Tests.xproj", "{2740763E-959A-4AAD-BFC9-5B428393DFDE}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Artifacts", "Artifacts", "{40D1EC3F-DCD9-47EB-8629-54D71AC31757}"
11+
ProjectSection(SolutionItems) = preProject
12+
appveyor.yml = appveyor.yml
13+
Build.ps1 = Build.ps1
14+
CHANGES.md = CHANGES.md
15+
global.json = global.json
16+
README.md = README.md
17+
EndProjectSection
718
EndProject
819
Global
920
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1021
Debug|Any CPU = Debug|Any CPU
1122
Release|Any CPU = Release|Any CPU
1223
EndGlobalSection
1324
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{DA0432BD-FDA0-40C9-BCF1-A38F601600D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{DA0432BD-FDA0-40C9-BCF1-A38F601600D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{DA0432BD-FDA0-40C9-BCF1-A38F601600D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{DA0432BD-FDA0-40C9-BCF1-A38F601600D3}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{EDB6E773-0A33-4A88-81BC-3B24ABFEBA61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26+
{EDB6E773-0A33-4A88-81BC-3B24ABFEBA61}.Debug|Any CPU.Build.0 = Debug|Any CPU
27+
{EDB6E773-0A33-4A88-81BC-3B24ABFEBA61}.Release|Any CPU.ActiveCfg = Release|Any CPU
28+
{EDB6E773-0A33-4A88-81BC-3B24ABFEBA61}.Release|Any CPU.Build.0 = Release|Any CPU
29+
{2740763E-959A-4AAD-BFC9-5B428393DFDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{2740763E-959A-4AAD-BFC9-5B428393DFDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{2740763E-959A-4AAD-BFC9-5B428393DFDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
32+
{2740763E-959A-4AAD-BFC9-5B428393DFDE}.Release|Any CPU.Build.0 = Release|Any CPU
1833
EndGlobalSection
1934
GlobalSection(SolutionProperties) = preSolution
2035
HideSolutionNode = FALSE
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>edb6e773-0a33-4a88-81bc-3b24abfeba61</ProjectGuid>
10+
<RootNamespace>Serilog.Sinks.AzureTableStorage</RootNamespace>
11+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
12+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
13+
</PropertyGroup>
14+
15+
<PropertyGroup>
16+
<SchemaVersion>2.0</SchemaVersion>
17+
</PropertyGroup>
18+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
19+
</Project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "2.0.1-*",
3+
"description": "Serilog event sink that writes to Azure Table Storage over HTTP.",
4+
5+
"authors": [ "Robert Moore" ],
6+
"packOptions": {
7+
"tags": [ "serilog", "logging", "azure" ],
8+
"projectUrl": "https://github.com/serilog/serilog-sinks-azuretablestorage",
9+
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
10+
"iconUrl": "http://serilog.net/images/serilog-sink-nuget.png"
11+
},
12+
"dependencies": {
13+
"Serilog": "2.0.0",
14+
"Serilog.Sinks.PeriodicBatching": "2.0.0",
15+
"WindowsAzure.Storage": "4.3.0"
16+
},
17+
"buildOptions": {
18+
"keyFile": "../../assets/Serilog.snk"
19+
},
20+
"frameworks": {
21+
"net4.5": {
22+
"frameworkAssemblies": {
23+
"System.Configuration": ""
24+
}
25+
}
26+
}
27+
}

test/Serilog.Sinks.AzureTableStorageWithProperties.Tests/AzureStorageEmulatorManager.cs

Lines changed: 72 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,42 @@ namespace Serilog.Sinks.AzureTableStorage.Tests
1212
public static class AzureStorageEmulatorManager
1313
{
1414
private const string _windowsAzureStorageEmulatorPath = @"C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\WAStorageEmulator.exe";
15-
private const string _win7ProcessName = "WAStorageEmulator";
15+
16+
private const string _win7ProcessName = "WAStorageEmulator";
1617
private const string _win8ProcessName = "WASTOR~1";
1718

18-
private static readonly ProcessStartInfo startStorageEmulator = new ProcessStartInfo
19-
{
20-
FileName = _windowsAzureStorageEmulatorPath,
21-
Arguments = "start",
22-
};
19+
private const string _azureStorageEmulator4_4Path = @"C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe";
20+
private const string _processName4_4 = "AzureStorageEmulator";
21+
22+
private static readonly ProcessStartInfo startStorageEmulator = new ProcessStartInfo
23+
{
24+
FileName = _windowsAzureStorageEmulatorPath,
25+
Arguments = "start",
26+
};
2327

24-
private static readonly ProcessStartInfo stopStorageEmulator = new ProcessStartInfo
28+
private static readonly ProcessStartInfo startStorageEmulator4_4 = new ProcessStartInfo
29+
{
30+
FileName = _azureStorageEmulator4_4Path,
31+
Arguments = "start",
32+
};
33+
34+
private static readonly ProcessStartInfo stopStorageEmulator = new ProcessStartInfo
2535
{
2636
FileName = _windowsAzureStorageEmulatorPath,
2737
Arguments = "stop",
2838
};
2939

30-
private static Process GetProcess()
40+
private static readonly ProcessStartInfo stopStorageEmulator4_4 = new ProcessStartInfo
41+
{
42+
FileName = _azureStorageEmulator4_4Path,
43+
Arguments = "stop",
44+
};
45+
46+
private static Process GetProcess()
3147
{
32-
return Process.GetProcessesByName(_win7ProcessName).FirstOrDefault() ?? Process.GetProcessesByName(_win8ProcessName).FirstOrDefault();
48+
return Process.GetProcessesByName(_win7ProcessName).FirstOrDefault()
49+
?? Process.GetProcessesByName(_win8ProcessName).FirstOrDefault()
50+
?? Process.GetProcessesByName(_processName4_4).FirstOrDefault();
3351
}
3452

3553
public static bool IsProcessStarted()
@@ -41,19 +59,53 @@ public static void StartStorageEmulator()
4159
{
4260
if (!IsProcessStarted())
4361
{
44-
using (Process process = Process.Start(startStorageEmulator))
45-
{
46-
process.WaitForExit();
47-
}
48-
}
62+
try
63+
{
64+
using (Process process = Process.Start(startStorageEmulator4_4))
65+
{
66+
process.WaitForExit();
67+
}
68+
}
69+
catch(System.ComponentModel.Win32Exception ex)
70+
{
71+
if (ex.Message == "The system cannot find the file specified")
72+
{
73+
using (Process process = Process.Start(startStorageEmulator))
74+
{
75+
process.WaitForExit();
76+
}
77+
}
78+
else
79+
{
80+
throw;
81+
}
82+
}
83+
}
4984
}
5085

5186
public static void StopStorageEmulator()
5287
{
53-
using (Process process = Process.Start(stopStorageEmulator))
54-
{
55-
process.WaitForExit();
56-
}
57-
}
58-
}
88+
try
89+
{
90+
using (Process process = Process.Start(stopStorageEmulator4_4))
91+
{
92+
process.WaitForExit();
93+
}
94+
}
95+
catch (System.ComponentModel.Win32Exception ex)
96+
{
97+
if (ex.Message == "The system cannot find the file specified")
98+
{
99+
using (Process process = Process.Start(stopStorageEmulator))
100+
{
101+
process.WaitForExit();
102+
}
103+
}
104+
else
105+
{
106+
throw;
107+
}
108+
}
109+
}
110+
}
59111
}

0 commit comments

Comments
 (0)