Skip to content

Commit

Permalink
Stability improvements (#7)
Browse files Browse the repository at this point in the history
We've made a couple of stability improvements by updating various packages to their latest versions. Additionally we've added a continuous integration and continuous delivery pipeline based on Azure DevOps so we can more easily dogfood these tools.
  • Loading branch information
jmezach authored and marktaling committed Oct 10, 2018
1 parent 4909de8 commit 4b27614
Show file tree
Hide file tree
Showing 28 changed files with 428 additions and 204 deletions.
3 changes: 2 additions & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
next-version: 0.1.0
next-version: 0.2.0
mode: ContinuousDeployment
branches: {}
ignore:
sha: []
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Augurk.CSharpAnalyzer

[![Build Status](https://dev.azure.com/augurk/Augurk/_apis/build/status/Augurk.CSharpAnalyzer)](https://dev.azure.com/augurk/Augurk/_build/latest?definitionId=3)
[![Release Status](https://vsrm.dev.azure.com/augurk/_apis/public/Release/badge/5a86f7f3-d9bb-4198-9b43-bbb7d066dd90/3/5)](https://vsrm.dev.azure.com/augurk/_apis/public/Release/badge/5a86f7f3-d9bb-4198-9b43-bbb7d066dd90/3/5)

Augurk.CSharpAnalyzer is an extension to the Augurk ecosystem that will (eventually) allow users of Augurk to visualize the dependencies between their
features, even across their entire product portfolio. To do this, Augurk.CSharpAnalyzer uses Roslyn to do static code analysis and tries to figure out
what is being called by the when steps of a feature. All that information is then accumulated and sent to Augurk for analysis.
Expand Down
23 changes: 0 additions & 23 deletions appveyor.yml

This file was deleted.

143 changes: 143 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/vsts/pipelines/apps/windows/dot-net

variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'

jobs:
- job: Windows
pool:
vmImage: 'VS2017-Win2016'
steps:
- task: NuGetToolInstaller@0

- task: GitVersion@3
inputs:
updateAssemblyInfo: true

- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'

- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArgs: '/p:Version=$(GitVersion.MajorMinorPatch) /p:InformationalVersion=$(GitVersion.InformationalVersion)'

- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
testAssemblyVer2: '$(Build.SourcesDirectory)\src\Augurk.CSharpAnalyzer.Specifications\bin\$(buildConfiguration)\Augurk.CSharpAnalyzer.Specifications.dll'
codeCoverageEnabled: True
otherConsoleOptions: '/platform:X64'

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)\src\Augurk.CSharpAnalyzer.NetFx\bin\$(buildConfiguration)'
includeRootFolder: false
archiveType: zip
archiveFile: '$(Build.ArtifactStagingDirectory)\Augurk.CSharpAnalyzer-win-x64-$(Build.BuildNumber).zip'

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: Windows
publishLocation: Container

- powershell: |
echo "##vso[task.setvariable variable=GitVersion.MajorMinorPatch;isOutput=true]$(GitVersion.MajorMinorPatch)"
echo "##vso[task.setvariable variable=GitVersion.InformationalVersion;isOutput=true]$(GitVersion.InformationalVersion)"
echo "##vso[task.setvariable variable=Build.BuildNumber;isOutput=true]$(Build.BuildNumber)"
name: setOutputVariables
- job: macOS
dependsOn: Windows # For now, since we can't run GitVersion on macOS
pool:
vmImage: macOS-10.13
variables:
GitVersion.MajorMinorPatch: $[dependencies.Windows.outputs['setOutputVariables.GitVersion.MajorMinorPatch']]
GitVersion.InformationalVersion: $[dependencies.Windows.outputs['setOutputVariables.GitVersion.InformationalVersion']]
Build.BuildNumber: $[dependencies.Windows.outputs['setOutputVariables.Build.BuildNumber']]
steps:
- task: DotNetCoreCLI@2
inputs:
command: build
projects: 'src/Augurk.CSharpAnalyzer.NetCore/Augurk.CSharpAnalyzer.NetCore.csproj'
arguments: '-r osx-x64 -c $(buildConfiguration)'

- task: DotNetCoreCLI@2
enabled: false # For now since we don't have a viable testing project
inputs:
command: test
projects: 'src/Augurk.CSharpAnalyzer.UnitTest/Augurk.CSharpAnalyzer.UnitTest.csproj'
continueOnError: true

- task: DotNetCoreCLI@2
inputs:
command: publish
projects: 'src/Augurk.CSharpAnalyzer.NetCore/Augurk.CSharpAnalyzer.NetCore.csproj'
arguments: '-r osx-x64 -c $(buildConfiguration) /p:Version=$(GitVersion.MajorMinorPatch) /p:InformationalVersion=$(GitVersion.InformationalVersion)'
zipAfterPublish: false
publishWebProjects: false

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/src/Augurk.CSharpAnalyzer.NetCore/bin/$(buildConfiguration)/netcoreapp2.1/osx-x64/publish/'
includeRootFolder: false
archiveType: zip
archiveFile: '$(Build.ArtifactStagingDirectory)/Augurk.CSharpAnalyzer-osx-x64-$(Build.BuildNumber).zip'

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: macOS
publishLocation: Container

- job: Linux
dependsOn: Windows # For now, since we can't run GitVersion on macOS
pool:
vmImage: ubuntu-16.04
variables:
GitVersion.MajorMinorPatch: $[dependencies.Windows.outputs['setOutputVariables.GitVersion.MajorMinorPatch']]
GitVersion.InformationalVersion: $[dependencies.Windows.outputs['setOutputVariables.GitVersion.InformationalVersion']]
Build.BuildNumber: $[dependencies.Windows.outputs['setOutputVariables.Build.BuildNumber']]
steps:
- task: DotNetCoreCLI@2
inputs:
command: build
projects: 'src/Augurk.CSharpAnalyzer.NetCore/Augurk.CSharpAnalyzer.NetCore.csproj'
arguments: '-r linux-x64 -c $(buildConfiguration)'

- task: DotNetCoreCLI@2
enabled: false # For now since we don't have a viable testing project
inputs:
command: test
projects: 'src/Augurk.CSharpAnalyzer.UnitTest/Augurk.CSharpAnalyzer.UnitTest.csproj'

- task: DotNetCoreCLI@2
inputs:
command: publish
projects: 'src/Augurk.CSharpAnalyzer.NetCore/Augurk.CSharpAnalyzer.NetCore.csproj'
arguments: '-r linux-x64 -c $(buildConfiguration) /p:Version=$(GitVersion.MajorMinorPatch) /p:InformationalVersion=$(GitVersion.InformationalVersion)'
zipAfterPublish: false
publishWebProjects: false

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/src/Augurk.CSharpAnalyzer.NetCore/bin/$(buildConfiguration)/netcoreapp2.1/linux-x64/publish/'
includeRootFolder: false
archiveType: zip
archiveFile: '$(Build.ArtifactStagingDirectory)/Augurk.CSharpAnalyzer-linux-x64-$(Build.BuildNumber).zip'

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: Linux
publishLocation: Container
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="1.3.2" />
<PackageReference Include="MSTest.TestFramework" Version="1.3.2" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="SpecFlow" Version="2.3.2" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="SpecFlow" Version="2.4.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
14 changes: 6 additions & 8 deletions src/Augurk.CSharpAnalyzer.Core/Augurk.CSharpAnalyzer.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Buildalyzer" Version="0.4.0" />
<PackageReference Include="Buildalyzer.Workspaces" Version="0.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="2.8.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.9.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.9.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="2.9.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="2.9.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Oakton" Version="1.5.0" />
</ItemGroup>

Expand Down
16 changes: 14 additions & 2 deletions src/Augurk.CSharpAnalyzer.Core/Commands/AnalyzeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ limitations under the License.
*/
using Augurk.CSharpAnalyzer.Analyzers;
using Augurk.CSharpAnalyzer.Options;
using Buildalyzer;
using Buildalyzer.Workspaces;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
Expand Down Expand Up @@ -95,6 +93,20 @@ public async Task<JToken> Analyze(AnalyzeOptions options)
var specProject = workspace.CurrentSolution.Projects.FirstOrDefault(p => p.Name == options.SpecificationsProject);
var compilation = projects[specProject].Value;

// Make sure that the project compiled succesfully
var diagnostics = compilation.GetDiagnostics();
if (diagnostics.Any(d => d.Severity == DiagnosticSeverity.Error))
{
// Errors occured during compilation, we cannot continue here
ConsoleWriter.Write(ConsoleColor.Red, $"The following errors occured during compilation of solution '{solutionPath}'");
foreach (var diagnostic in diagnostics)
{
ConsoleWriter.WriteWithIndent(ConsoleColor.Red, 1, diagnostic.ToString());
}

throw new InvalidOperationException("Unable to analyze solution due to compile errors.");
}

// Build the analysis context and go through each syntax tree
var context = new AnalyzeContext(projects, options);
foreach (var tree in compilation.SyntaxTrees)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>7.1</LangVersion>
<AssemblyName>Augurk.CSharpAnalyzer</AssemblyName>
<RootNamespace>Augurk.CSharpAnalyzer</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Buildalyzer.Workspaces" Version="2.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Augurk.CSharpAnalyzer.Core\Augurk.CSharpAnalyzer.Core.csproj" />
</ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions src/Augurk.CSharpAnalyzer.NetCore/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ You may obtain a copy of the License at
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using Oakton;
using Augurk.CSharpAnalyzer.Commands;
using System.Threading.Tasks;
Expand Down Expand Up @@ -52,7 +51,7 @@ static async Task<int> Main(string[] args)

int result = await executor.ExecuteAsync(args);
#if DEBUG
Console.ReadLine();
System.Console.ReadLine();
#endif
return result;
}
Expand Down
12 changes: 0 additions & 12 deletions src/Augurk.CSharpAnalyzer.NetFx/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,4 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Utilities.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Locator">
<Version>1.0.31</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild">
<Version>2.9.0</Version>
</PackageReference>
<PackageReference Include="Oakton">
<Version>1.5.0</Version>
</PackageReference>
Expand Down
2 changes: 2 additions & 0 deletions src/Augurk.CSharpAnalyzer.NetFx/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ limitations under the License.
using System.Reflection;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.MSBuild;
using Microsoft.Build.Locator;

namespace Augurk.CSharpAnalyzer
{
Expand Down Expand Up @@ -58,6 +59,7 @@ static async Task<int> Main(string[] args)

static async Task<Workspace> GetWorkspace(string solutionPath)
{
MSBuildLocator.RegisterDefaults();
var workspace = MSBuildWorkspace.Create();
await workspace.OpenSolutionAsync(solutionPath);
return workspace;
Expand Down
12 changes: 0 additions & 12 deletions src/Augurk.CSharpAnalyzer.Specifications/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,4 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Utilities.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Loading

0 comments on commit 4b27614

Please sign in to comment.