Skip to content

Commit

Permalink
add audit mode to ci (#948)
Browse files Browse the repository at this point in the history
* add audit mode to ci
  • Loading branch information
adiviness authored May 24, 2019
1 parent 80f1079 commit cc30475
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 28 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
x64/
x86/
ARM64/
build/
bld/
[Bb]in/
[Oo]bj/
Expand Down
4 changes: 4 additions & 0 deletions build/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ pr:
name: 0.0.$(Date:yyMM).$(Date:dd)$(Rev:rr)

jobs:
- template: ./templates/build-console-audit-job.yml
parameters:
platform: x64

- template: ./templates/build-console-ci.yml
parameters:
platform: x64
Expand Down
4 changes: 4 additions & 0 deletions build/pipelines/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ variables:
name: 'Terminal_$(date:yyMM).$(date:dd)$(rev:rrr)'

jobs:
- template: ./templates/build-console-audit-job.yml
parameters:
platform: x64

- template: ./templates/build-console-int.yml
parameters:
platform: x64
Expand Down
53 changes: 53 additions & 0 deletions build/pipelines/templates/build-console-audit-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
parameters:
platform: ''
additionalBuildArguments: ''

jobs:
- job: Build${{ parameters.platform }}AuditMode
displayName: Static Analysis Build ${{ parameters.platform }}
variables:
BuildConfiguration: AuditMode
BuildPlatform: ${{ parameters.platform }}
pool: { vmImage: vs2017-win2016 }

steps:
- checkout: self
submodules: true
clean: true

- task: NuGetToolInstaller@0
displayName: Ensure NuGet 4.8.1
inputs:
versionSpec: 4.8.1

# In the Microsoft Azure DevOps tenant, NuGetCommand is ambiguous.
# This should be `task: NuGetCommand@2`
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: Restore NuGet packages
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: OpenConsole.sln
restoreDirectory: '$(Build.SourcesDirectory)\packages'

- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: 'NuGet restore packages for CI'
inputs:
command: restore
restoreSolution: build/.nuget/packages.config
feedsToUse: config
externalFeedCredentials: 'TAEF NuGet Feed'
nugetConfigPath: build/config/NuGet.config
restoreDirectory: '$(Build.SourcesDirectory)/packages'

- task: VSBuild@1
displayName: 'Build solution **\OpenConsole.sln'
inputs:
solution: '**\OpenConsole.sln'
vsVersion: 15.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: ${{ parameters.additionalBuildArguments }}
clean: true
maximumCpuCount: true
4 changes: 2 additions & 2 deletions build/pipelines/templates/build-console-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ parameters:
additionalBuildArguments: ''

jobs:
- job: Build${{ parameters.platform }}
displayName: Build ${{ parameters.platform }}
- job: Build${{ parameters.platform }}${{ parameters.configuration }}
displayName: Build ${{ parameters.platform }} ${{ parameters.configuration }}
variables:
BuildConfiguration: ${{ parameters.configuration }}
BuildPlatform: ${{ parameters.platform }}
Expand Down
4 changes: 2 additions & 2 deletions build/pipelines/templates/build-console-int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ parameters:
additionalBuildArguments: ''

jobs:
- job: Build${{ parameters.platform }}
displayName: Build ${{ parameters.platform }}
- job: Build${{ parameters.platform }}${{ parameters.configuration }}
displayName: Build ${{ parameters.platform }} ${{ parameters.configuration }}
variables:
BuildConfiguration: ${{ parameters.configuration }}
BuildPlatform: ${{ parameters.platform }}
Expand Down
16 changes: 9 additions & 7 deletions build/pipelines/templates/release-sign-and-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ jobs:
displayName: Sign and Deploy for ${{ parameters.configuration }}

dependsOn:
- Buildx64
- Buildx86
- Buildarm64
- Buildx64AuditMode
- Buildx64Release
- Buildx86Release
- Buildarm64Release
condition: |
and
(
in(dependencies.Buildx64.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.Buildx86.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.Buildarm64.result, 'Succeeded', 'SucceededWithIssues', 'Skipped')
)
in(dependencies.Buildx64AuditMode.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.Buildx64Release.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.Buildx86Release.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.Buildarm64Release.result, 'Succeeded', 'SucceededWithIssues', 'Skipped')
)
variables:
BuildConfiguration: ${{ parameters.configuration }}
Expand Down
7 changes: 7 additions & 0 deletions src/StaticAnalysis.ruleset
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Console Rules" Description="These rules enforce static analysis on console code." ToolsVersion="15.0">

<Include Path="cppcorecheckrules.ruleset" Action="Default" />

<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
<Rule Id="C6001" Action="Error" />
<Rule Id="C6011" Action="Error" />
</Rules>

</RuleSet>
1 change: 0 additions & 1 deletion src/buffer/out/precomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Module Name:
#include "LibraryIncludes.h"

#pragma warning(push)
#pragma warning(disable: ALL_CPPCORECHECK_WARNINGS)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#endif
Expand Down
2 changes: 0 additions & 2 deletions src/cascadia/TerminalApp/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include "App.g.h"
#include "../../cascadia/inc/cppwinrt_utils.h"

#include <wil/filesystem.h>

#include <winrt/Microsoft.Terminal.TerminalControl.h>

#include <winrt/Microsoft.UI.Xaml.Controls.h>
Expand Down
2 changes: 0 additions & 2 deletions src/cascadia/TerminalApp/CascadiaSettingsSerialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include "CascadiaSettings.h"
#include "../../types/inc/utils.hpp"
#include <appmodel.h>
#include <wil/com.h>
#include <wil/filesystem.h>
#include <shlobj.h>

using namespace ::TerminalApp;
Expand Down
1 change: 0 additions & 1 deletion src/cascadia/TerminalConnection/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@

#include "winrt/Windows.Foundation.h"
#include <Windows.h>
#include <wil/result.h>
5 changes: 5 additions & 0 deletions src/common.build.post.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<!-- Exclude our dependencies from static analysis. CAExcludePath can only be
set after we've imported Microsoft.Cpp.targets -->
<PropertyGroup>
<CAExcludePath>$(SolutionDir)\dep\;$(CAExcludePath)</CAExcludePath>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions src/common.build.pre.props
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<!-- For our Audit mode -->
<PropertyGroup Condition="'$(Configuration)'=='AuditMode'">
<!-- For our Audit mode -->
<PropertyGroup Condition="'$(Configuration)'=='AuditMode'">
<CodeAnalysisRuleSet>$(SolutionDir)\src\StaticAnalysis.ruleset</CodeAnalysisRuleSet>
<EnableCppCoreCheck>true</EnableCppCoreCheck>
<RunCodeAnalysis>true</RunCodeAnalysis>
Expand Down
7 changes: 4 additions & 3 deletions src/inc/LibraryIncludes.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

#pragma once

#include <CppCoreCheck/Warnings.h>

#pragma warning(push)
#pragma warning(disable: ALL_CPPCORECHECK_WARNINGS)

// C
#include <climits>
Expand Down Expand Up @@ -44,19 +42,22 @@
#include <functional>

// WIL

#include <wil/Common.h>
#include <wil/Result.h>
#include <wil/resource.h>
#include <wil/wistd_memory.h>
#include <wil/com.h>
#include <wil/filesystem.h>

// GSL
// Block GSL Multi Span include because it both has C++17 deprecated iterators
// and uses the C-namespaced "max" which conflicts with Windows definitions.
#define GSL_MULTI_SPAN_H
#include <gsl/gsl>

// CppCoreCheck
#include <CppCoreCheck/Warnings.h>

// IntSafe
#define ENABLE_INTSAFE_SIGNED_FUNCTIONS
#include <intsafe.h>
Expand Down
5 changes: 0 additions & 5 deletions src/propsheet/precomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@
#include "strid.h"
#include "..\propslib\conpropsp.hpp"

// WIL
#include <new>
#include <wil/Common.h>
#include <wil/Result.h>
#include <wil/resource.h>
#include <wil/wistd_memory.h>

// This is currently bubbling up the source tree to our branch
#ifndef WM_DPICHANGED_BEFOREPARENT
Expand Down

0 comments on commit cc30475

Please sign in to comment.