Skip to content

Commit da6a26a

Browse files
authored
Create msvc.yml
1 parent 55e33ab commit da6a26a

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/msvc.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
#
6+
# Find more information at:
7+
# https://github.com/microsoft/msvc-code-analysis-action
8+
9+
name: Microsoft C++ Code Analysis
10+
11+
on:
12+
push:
13+
branches: [ "main" ]
14+
pull_request:
15+
branches: [ "main" ]
16+
schedule:
17+
- cron: '39 19 * * 3'
18+
19+
env:
20+
# Path to the CMake build directory.
21+
build: '${{ github.workspace }}/build'
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
analyze:
28+
permissions:
29+
contents: read # for actions/checkout to fetch code
30+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
31+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
32+
name: Analyze
33+
runs-on: windows-latest
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
39+
- name: Configure CMake
40+
run: cmake -B ${{ env.build }}
41+
42+
# Build is not required unless generated source files are used
43+
# - name: Build CMake
44+
# run: cmake --build ${{ env.build }}
45+
46+
- name: Initialize MSVC Code Analysis
47+
uses: microsoft/msvc-code-analysis-action@04825f6d9e00f87422d6bf04e1a38b1f3ed60d99
48+
# Provide a unique ID to access the sarif output path
49+
id: run-analysis
50+
with:
51+
cmakeBuildDirectory: ${{ env.build }}
52+
# Ruleset file that will determine what checks will be run
53+
ruleset: NativeRecommendedRules.ruleset
54+
55+
# Upload SARIF file to GitHub Code Scanning Alerts
56+
- name: Upload SARIF to GitHub
57+
uses: github/codeql-action/upload-sarif@v3
58+
with:
59+
sarif_file: ${{ steps.run-analysis.outputs.sarif }}
60+
61+
# Upload SARIF file as an Artifact to download and view
62+
# - name: Upload SARIF as an Artifact
63+
# uses: actions/upload-artifact@v3
64+
# with:
65+
# name: sarif-file
66+
# path: ${{ steps.run-analysis.outputs.sarif }}

0 commit comments

Comments
 (0)