Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#102-UpgradeToDotNetCore2.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Evelyn.Client.Rest/Evelyn.Client.Rest.csproj
#	src/Evelyn.Client/Evelyn.Client.csproj
#	src/Evelyn.Core/Evelyn.Core.csproj
#	src/Evelyn.Management.Api.Rest/Evelyn.Management.Api.Rest.csproj
#	src/Evelyn.Server.Host/Evelyn.Server.Host.csproj
#	src/Evelyn.Storage.EventStore/Evelyn.Storage.EventStore.csproj
#	src/Evelyn.sln
  • Loading branch information
binarymash committed Jun 2, 2018
2 parents 132da5f + 55ad50c commit 66ebded
Show file tree
Hide file tree
Showing 36 changed files with 519 additions and 94 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,28 @@ This repository is built on [AppVeyor](https://ci.appveyor.com/project/binarymas

#### Releases

[![Build status](https://ci.appveyor.com/api/projects/status/fe6ta6qtgyat5i6u/branch/master?svg=true)](https://ci.appveyor.com/project/binarymash/evelyn/branch/master)
| | Build Status | Test Coverage |
|--------------------|--------------------|-------------------|
| Windows (AppVeyor) | [![Build status](https://ci.appveyor.com/api/projects/status/fe6ta6qtgyat5i6u/branch/master?svg=true)](https://ci.appveyor.com/project/binarymash/evelyn/branch/master) | [![Coverage Status](https://coveralls.io/repos/github/binarymash/evelyn/badge.svg?branch=master)](https://coveralls.io/github/binarymash/evelyn?branch=master) |
| Ubuntu (AppVeyor) | [![Build status](https://ci.appveyor.com/api/projects/status/fya8g0lne2ru7j5c/branch/master?svg=true)](https://ci.appveyor.com/project/binarymash/evelyn-4lkyc/branch/master) | - |

[![Coverage Status](https://coveralls.io/repos/github/binarymash/evelyn/badge.svg?branch=master)](https://coveralls.io/github/binarymash/evelyn?branch=master)
Release builds are published to https://www.nuget.org/

Release builds are published to https://www.myget.org/F/binarymash-stable/api/v3/index.json
- [Evelyn.Core](https://www.nuget.org/packages/Evelyn.Core/)
- [Evelyn.Management.Api.Rest](https://www.nuget.org/packages/Evelyn.Management.Api.Rest/)
- [Evelyn.Storage.EventStore](https://www.nuget.org/packages/Evelyn.Storage.EventStore/)
- [Evelyn.Client](https://www.nuget.org/packages/Evelyn.Client/)
- [Evelyn.Client.Rest](https://www.nuget.org/packages/Evelyn.Client.Rest/)

#### Development

[![Build status](https://ci.appveyor.com/api/projects/status/fe6ta6qtgyat5i6u/branch/develop?svg=true)](https://ci.appveyor.com/project/binarymash/evelyn/branch/develop)
| | Build Status | Test Coverage |
|--------------------|--------------------|-------------------|
| Windows (AppVeyor) | [![Build status](https://ci.appveyor.com/api/projects/status/fe6ta6qtgyat5i6u/branch/develop?svg=true)](https://ci.appveyor.com/project/binarymash/evelyn/branch/develop) | [![Coverage Status](https://coveralls.io/repos/github/binarymash/evelyn/badge.svg?branch=develop)](https://coveralls.io/github/binarymash/evelyn?branch=develop) |
| Ubuntu (AppVeyor) | [![Build status](https://ci.appveyor.com/api/projects/status/fya8g0lne2ru7j5c/branch/develop?svg=true)](https://ci.appveyor.com/project/binarymash/evelyn-4lkyc/branch/develop) | - |




[![Coverage Status](https://coveralls.io/repos/github/binarymash/evelyn/badge.svg?branch=develop)](https://coveralls.io/github/binarymash/evelyn?branch=develop)

Development builds are published to https://www.myget.org/F/binarymash-unstable/api/v3/index.json
59 changes: 52 additions & 7 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#addin "nuget:?package=Cake.Json"
#addin "nuget:?package=Newtonsoft.Json&version=9.0.1"
#tool "nuget:?package=xunit.runner.console"
#tool coveralls.net
#tool "nuget:?package=coveralls.net&version=0.7.0"
#addin Cake.Coveralls

// compile
var compileConfig = Argument("configuration", "Release");
var compileConfig = ValidateConfig(Argument("configuration", "Release"));
var slnFile = "./src/Evelyn.sln";

// build artifacts
Expand Down Expand Up @@ -140,6 +140,23 @@ Task("RunUnitTestsCoverageReport")

EnsureDirectoryExists(artifactsForUnitTestsDir);

if(!IsRunningOnWindows())
{
Warning("We are not running on Windows so we can't run test coverage, but we will run the tests.");
foreach(var testAssembly in unitTestAssemblies)
{
DotNetCoreTest(testAssembly, new DotNetCoreTestSettings()
{
ArgumentCustomization = args => args
.Append("--no-build")
.Append("--no-restore")
.Append("--results-directory " + artifactsForUnitTestsDir)
.Append("--configuration " + compileConfig)
});
}
return;
}

foreach(var testAssembly in unitTestAssemblies)
{
Information("Running test task for " + testAssembly);
Expand All @@ -165,7 +182,7 @@ Task("RunUnitTestsCoverageReport")
{
Information("Running test task for " + testAssembly);

if (IsRunningOnWindows())
if (!IsCrossPlatformConfig(compileConfig))
{
XUnit2(testAssembly, new XUnit2Settings
{
Expand All @@ -185,7 +202,7 @@ Task("RunUnitTestsCoverageReport")
Information($"writing to {artifactsForUnitTestsDir}");
ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);

if (AppVeyor.IsRunningOnAppVeyor)
if (IsAuthoritativeBuild())
{
var repoToken = EnvironmentVariable(coverallsRepoToken);
if (string.IsNullOrEmpty(repoToken))
Expand All @@ -201,7 +218,7 @@ Task("RunUnitTestsCoverageReport")
}
else
{
Information("We are not running on the build server so we won't publish the coverage report to coveralls.io");
Information("We are not running on the authoritative build server so we won't publish the coverage report to coveralls.io");
}

var sequenceCoverage = XmlPeek(coverageSummaryFile, "//CoverageSession/Summary/@sequenceCoverage");
Expand Down Expand Up @@ -278,9 +295,9 @@ Task("ReleasePackagesToUnstableFeed")
Task("EnsureStableReleaseRequirements")
.Does(() =>
{
if (!AppVeyor.IsRunningOnAppVeyor)
if (!IsAuthoritativeBuild())
{
throw new Exception("Stable release should happen via appveyor");
throw new Exception("Stable release should happen via authoriative build server");
}

var isTag =
Expand Down Expand Up @@ -332,6 +349,34 @@ Task("Release")

RunTarget(target);

private bool IsAuthoritativeBuild()
{
return AppVeyor.IsRunningOnAppVeyor && IsRunningOnWindows();
}

private string ValidateConfig(string config)
{
if (IsRunningOnWindows())
{
return config;
}

if (IsCrossPlatformConfig(config))
{
return config;
}

config += "-xPlatform";
Information("Not running on Windows, so switching build configuration to " + config);

return config;
}

private bool IsCrossPlatformConfig(string config)
{
return config.EndsWith("-xPlatform");
}

/// Gets unique nuget version for this commit
private GitVersion GetNuGetVersionForCommit()
{
Expand Down
7 changes: 7 additions & 0 deletions releasenotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes

## Version 0.10.0 (2018-06-01)

- [#116](https://github.com/binarymash/evelyn/issues/116) - Linux build pipeline contributed by Philip Wood ([binarymash](https://github.com/binarymash))
- [#115](https://github.com/binarymash/evelyn/pull/115) - Feature/#113 add name to environments contributed by Philip Wood ([binarymash](https://github.com/binarymash))

Commits: 70cb7f43aa...e91a58bb7f

## Version 0.9.0 (2018-05-29)

- [#112](https://github.com/binarymash/evelyn/pull/112) - Publish stable to nuget.org contributed by Philip Wood ([binarymash](https://github.com/binarymash))
Expand Down
11 changes: 11 additions & 0 deletions src/Evelyn.Client.Host/Evelyn.Client.Host.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<ApplicationIcon />
<OutputType>Exe</OutputType>
<StartupObject />
<Configurations>Debug;Release;Debug-xPlatform;Release-xPlatform</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -16,10 +17,20 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-xPlatform|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>True</DebugSymbols>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-xPlatform|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Analyzers.Compatibility" Version="0.1.2-alpha" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="2.1.0" />
Expand Down
12 changes: 11 additions & 1 deletion src/Evelyn.Client.Rest/Evelyn.Client.Rest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<RepositoryUrl>https://github.com/binarymash/evelyn</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageLicenseUrl>https://github.com/binarymash/evelyn/blob/master/LICENSE</PackageLicenseUrl>

<Configurations>Debug;Release;Debug-xPlatform;Release-xPlatform</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -22,10 +22,20 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-xPlatform|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>True</DebugSymbols>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-xPlatform|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Analyzers.Compatibility" Version="0.1.2-alpha" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="2.1.0" />
Expand Down
9 changes: 9 additions & 0 deletions src/Evelyn.Client.Tests/Evelyn.Client.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,25 @@
<IsPackable>false</IsPackable>
<CodeAnalysisRuleSet>..\..\codeanalysis.ruleset</CodeAnalysisRuleSet>
<Version>0.0.0-dev</Version>
<Configurations>Debug;Release;Debug-xPlatform;Release-xPlatform</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-xPlatform|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-xPlatform|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.3.0" />
<PackageReference Include="FluentAssertions" Version="5.3.0" />
Expand Down
13 changes: 12 additions & 1 deletion src/Evelyn.Client/Evelyn.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<CodeAnalysisRuleSet>..\..\codeanalysis.ruleset</CodeAnalysisRuleSet>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0-dev</Version>
<Version>0.0.0-dev</Version>
<Description>Core functionality for Evelyn clients</Description>
<PackageProjectUrl>https://github.com/binarymash/evelyn</PackageProjectUrl>
<Copyright>Philip Wood 2018</Copyright>
Expand All @@ -13,6 +13,7 @@
<RepositoryUrl>https://github.com/binarymash/evelyn</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageLicenseUrl>https://github.com/binarymash/evelyn/blob/master/LICENSE</PackageLicenseUrl>
<Configurations>Debug;Release;Debug-xPlatform;Release-xPlatform</Configurations>

</PropertyGroup>

Expand All @@ -22,10 +23,20 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-xPlatform|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>True</DebugSymbols>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-xPlatform|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Analyzers.Compatibility" Version="0.1.2-alpha" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="2.1.0" />
Expand Down
11 changes: 10 additions & 1 deletion src/Evelyn.Core.Tests/Evelyn.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
<CodeAnalysisRuleSet>..\..\codeanalysis.ruleset</CodeAnalysisRuleSet>
<Version>0.0.0-dev</Version>
<Version>0.0.0-dev</Version>
<Configurations>Debug;Release;Debug-xPlatform;Release-xPlatform</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-xPlatform|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-xPlatform|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.3.0" />
<PackageReference Include="CompareNETObjects" Version="4.53.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ namespace Evelyn.Core.Tests.WriteModel.Project.AddEnvironment
public class CommandSpecs : ProjectCommandHandlerSpecs<Handler, Command>
{
private Guid _projectId;

private string _newEnvironmentName;
private string _newEnvironmentKey;

private string _existingEnvironmentName;
private string _existingEnvironmentKey;

private string _toggleKey;
private string _toggleName;
private int _projectVersion = -1;
Expand All @@ -31,6 +36,18 @@ public void EnvironmentAlreadyExistWithSameKey()
.BDDfy();
}

[Fact]
public void EnvironmentAlreadyExistWithSameName()
{
this.Given(_ => GivenWeHaveCreatedAProject())
.And(_ => GivenWeHaveAddedAnEnvironment())
.When(_ => WhenWeAddAnotherEnvironmentWithTheSameName())
.Then(_ => ThenNoEventIsPublished())
.And(_ => ThenADuplicateEnvironmentNameExceptionIsThrown())
.And(_ => ThenThereAreNoChangesOnTheAggregate())
.BDDfy();
}

[Fact]
public void StaleProjectVersion()
{
Expand Down Expand Up @@ -104,8 +121,9 @@ private void GivenWeHaveAddedAToggleToTheProject()
private void GivenWeHaveAddedAnEnvironment()
{
_existingEnvironmentKey = DataFixture.Create<string>();
_existingEnvironmentName = DataFixture.Create<string>();

HistoricalEvents.Add(new EnvironmentAdded(UserId, _projectId, _existingEnvironmentKey, DateTime.UtcNow) { Version = HistoricalEvents.Count });
HistoricalEvents.Add(new EnvironmentAdded(UserId, _projectId, _existingEnvironmentKey, _existingEnvironmentName, DateTime.UtcNow) { Version = HistoricalEvents.Count });
_projectVersion++;
}

Expand All @@ -122,18 +140,30 @@ private void GivenTheProjectVersionForOurNextCommandIsInTheFuture()
private void WhenWeAddAnEnvironment()
{
_newEnvironmentKey = DataFixture.Create<string>();
_newEnvironmentName = DataFixture.Create<string>();
UserId = DataFixture.Create<string>();

var command = new Command(UserId, _projectId, _newEnvironmentKey, _projectVersion);
var command = new Command(UserId, _projectId, _newEnvironmentKey, _newEnvironmentName, _projectVersion);
WhenWeHandle(command);
}

private void WhenWeAddAnotherEnvironmentWithTheSameKey()
{
_newEnvironmentKey = _existingEnvironmentKey;
_newEnvironmentName = DataFixture.Create<string>();
UserId = DataFixture.Create<string>();

var command = new Command(UserId, _projectId, _newEnvironmentKey, _projectVersion);
var command = new Command(UserId, _projectId, _newEnvironmentKey, _newEnvironmentName, _projectVersion);
WhenWeHandle(command);
}

private void WhenWeAddAnotherEnvironmentWithTheSameName()
{
_newEnvironmentKey = DataFixture.Create<string>();
_newEnvironmentName = _existingEnvironmentName;
UserId = DataFixture.Create<string>();

var command = new Command(UserId, _projectId, _newEnvironmentKey, _newEnvironmentName, _projectVersion);
WhenWeHandle(command);
}

Expand All @@ -159,6 +189,11 @@ private void ThenADuplicateEnvironmentKeyExceptionIsThrown()
ThenAnInvalidOperationExceptionIsThrownWithMessage($"There is already an environment with the key {_newEnvironmentKey}");
}

private void ThenADuplicateEnvironmentNameExceptionIsThrown()
{
ThenAnInvalidOperationExceptionIsThrownWithMessage($"There is already an environment with the name {_newEnvironmentName}");
}

private void ThenTheAggregateRootHasHadAnEnvironmentAdded()
{
var environment = NewAggregate.Environments.First(e => e.Key == _newEnvironmentKey);
Expand Down
Loading

0 comments on commit 66ebded

Please sign in to comment.