Skip to content

Commit

Permalink
Add workflow for MSVC analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Nov 3, 2021
1 parent 63b1392 commit 6f1f71c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/msvc-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Microsoft C++ Code Analysis

on: [push, pull_request]

env:
# Path to the CMake build directory.
build: '${{ github.workspace }}/build'

jobs:
analyze:
name: Analyze
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup
run: |
$Url = "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/binaries/boost_1_75_0-msvc-14.2-64.exe"
(New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost.exe")
Start-Process -Wait -FilePath "$env:TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=C:\local\boost-1.75.0"
- name: Configure CMake
env:
BOOST_ROOT: C:\local\boost-1.75.0
run: cmake -B ${{ env.build }} -DQL_USE_STD_CLASSES=ON

- name: Initialize MSVC Code Analysis
uses: microsoft/msvc-code-analysis-action@v0.1.0
# Provide a unique ID to access the sarif output path
id: run-analysis
env:
CAExcludePath: C:\local\boost-1.75.0
with:
cmakeBuildDirectory: ${{ env.build }}
buildConfiguration: Release
ruleset: '${{ github.workspace }}/.msvc-analysis.ruleset'

- name: Upload SARIF to GitHub
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: ${{ steps.run-analysis.outputs.sarif }}

- name: Upload SARIF as an Artifact
uses: actions/upload-artifact@v2
with:
name: sarif-file
path: ${{ steps.run-analysis.outputs.sarif }}

9 changes: 9 additions & 0 deletions .msvc-analysis.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Example" Description="Enable Warnings" ToolsVersion="10.0">
<!-- Default rules available in Visual Studio -->
<Include Path="NativeRecommendedRules.ruleset" Action="Default" />
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
<Rule Id="C26495" Action="None" /> <!-- Uninitialized members: too many -->
<Rule Id="C26451" Action="None" /> <!-- Arithmetic overflow: too many -->
</Rules>
</RuleSet>

0 comments on commit 6f1f71c

Please sign in to comment.