Skip to content

Commit

Permalink
Enable tests on CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
olsh committed Aug 10, 2019
1 parent 1aefa4c commit b56c9ce
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 19 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
[![Build status](https://ci.appveyor.com/api/projects/status/c4riih64hbd4sebw?svg=true)](https://ci.appveyor.com/project/olsh/resharper-structured-logging)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=resharper-structured-logging&metric=alert_status)](https://sonarcloud.io/dashboard?id=resharper-structured-logging)

An extension for ReSharper that highlights structured logging templates and contains some useful analyzers
An extension for ReSharper and Rider IDE that highlights structured logging templates and contains some useful analyzers

At the moment it supports Serilog, NLog, and Microsoft.Extensions.Logging

## Installation
## Installation ReSharper

Look for `Structured Logging` in ReSharper -> Extension manager.
[JetBrains Plugins Repository](https://plugins.jetbrains.com/plugin/12083-structured-logging)

## Installation Rider

Look for `Structured Logging` in Settings -> Plugins -> Browse repositories.
[JetBrains Plugins Repository](https://plugins.jetbrains.com/plugin/12832-structured-logging)

## Highlighting

![Highlighting](https://github.com/olsh/resharper-structured-logging/raw/master/images/highlighting.png)
Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ build_script:
dotnet cake -Target=CreateArtifact -buildConfig=Release
dotnet cake -Host="Rider" -Target=CreateArtifact -buildConfig=Release
dotnet cake -Target=Sonar -buildConfig=Release
test: off
cache:
- '%USERPROFILE%\.nuget\packages -> **\*.csproj'
Expand Down
31 changes: 17 additions & 14 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#tool "nuget:?package=MSBuild.SonarQube.Runner.Tool&version=4.6.0"
#tool "nuget:?package=NUnit.Runners&version=2.6.4"
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.10.0"

#addin "nuget:?package=Cake.Sonar&version=1.1.18"

Expand All @@ -16,6 +16,7 @@ if (host == riderHost)
projectName = solutionName + ".Rider";
}

var testProjectName = projectName + ".Tests";
var solutionFile = string.Format("./src/{0}.sln", solutionName);
var solutionFolder = string.Format("./src/{0}/", solutionName);
var projectFile = string.Format("{0}{1}.csproj", solutionFolder, projectName);
Expand All @@ -41,30 +42,37 @@ Task("UpdateBuildVersion")
Task("Build")
.Does(() =>
{
DotNetCoreBuild(projectFile, new DotNetCoreBuildSettings {
Configuration = buildConfiguration
});
MSBuild(projectFile, s =>
s.SetConfiguration(buildConfiguration)
.WithRestore());
});

Task("BuildSolution")
.Does(() =>
{
DotNetCoreBuild(solutionFile, new DotNetCoreBuildSettings {
Configuration = buildConfiguration
});
MSBuild(solutionFile, s =>
s.SetConfiguration(buildConfiguration)
.WithRestore());
});

Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
NUnit(string.Format("./test/src/bin/{0}/ReSharper.Structured.Logging.Tests.dll", buildConfiguration));
NUnit(string.Format("./test/src/bin/{0}/ReSharper.Structured.Logging.Rider.Tests.dll", buildConfiguration));
if (host == riderHost)
{
NUnit3(string.Format("./test/src/bin/{0}/{1}/ReSharper.Structured.Logging.Rider.Tests.dll", testProjectName, buildConfiguration));
}
else
{
NUnit3(string.Format("./test/src/bin/{0}/{1}/ReSharper.Structured.Logging.Tests.dll", testProjectName, buildConfiguration));
}
});

Task("NugetPack")
.IsDependentOn("AppendBuildNumber")
.IsDependentOn("Build")
.IsDependentOn("Test")
.Does(() =>
{
var buildPath = string.Format("./src/{0}/bin/{1}", solutionName, buildConfiguration);
Expand Down Expand Up @@ -154,11 +162,6 @@ Task("CreateArtifact")
BuildSystem.AppVeyor.UploadArtifact(artifactFile);
});

Task("CI")
.IsDependentOn("Sonar")
.IsDependentOn("Test")
.IsDependentOn("CreateArtifact");

Task("Default")
.IsDependentOn("NugetPack");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override void Run(IInvocationExpression element, ElementProblemAnalyze
return;
}

consumer.AddHighlighting(new DuplicateTemplatePropertyWarning(element.GetDocumentRange()));
consumer.AddHighlighting(new ContextualLoggerWarning(element.GetDocumentRange()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
<ItemGroup>
<PackageReference Include="JetBrains.Rider.SDK" Version="2019.2.0" />
</ItemGroup>
<PropertyGroup>
<OutputPath>bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.2.0" />
</ItemGroup>
<PropertyGroup>
<OutputPath>bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class A
class B {}

---------------------------------------------------------
(0):<overlapped> ReSharper Warning: Duplicate properties in message template
(0):<overlapped> ReSharper Warning: Incorrect type is used for contextual logger
3 changes: 2 additions & 1 deletion test/src/ReSharper.Structured.Logging.Rider.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<SonarQubeExclude>true</SonarQubeExclude>
<RootNamespace>ReSharper.Structured.Logging.Tests</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PropertyGroup>
<DefineConstants>RIDER</DefineConstants>
<OutputPath>bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
</PropertyGroup>
</Project>
3 changes: 3 additions & 0 deletions test/src/ReSharper.Structured.Logging.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\ReSharper.Structured.Logging\ReSharper.Structured.Logging.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputPath>bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
</PropertyGroup>
</Project>

0 comments on commit b56c9ce

Please sign in to comment.