2021-10-21 14:14:02 -07:00
|
|
|
# This workflow uses actions that are not certified by GitHub.
|
|
|
|
|
# They are provided by a third-party and are governed by
|
|
|
|
|
# separate terms of service, privacy policy, and support
|
|
|
|
|
# documentation.
|
|
|
|
|
#
|
|
|
|
|
# Find more information at:
|
|
|
|
|
# https://github.com/microsoft/msvc-code-analysis-action
|
|
|
|
|
|
|
|
|
|
name: Microsoft C++ Code Analysis
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches: [ $default-branch, $protected-branches ]
|
|
|
|
|
pull_request:
|
|
|
|
|
branches: [ $default-branch ]
|
|
|
|
|
schedule:
|
|
|
|
|
- cron: $cron-weekly
|
|
|
|
|
|
|
|
|
|
env:
|
|
|
|
|
# Path to the CMake build directory.
|
|
|
|
|
build: '${{ github.workspace }}/build'
|
|
|
|
|
|
2022-02-14 13:11:47 +05:30
|
|
|
permissions:
|
|
|
|
|
contents: read
|
|
|
|
|
|
2021-10-21 14:14:02 -07:00
|
|
|
jobs:
|
2021-10-21 16:18:11 -07:00
|
|
|
analyze:
|
2022-02-14 13:11:47 +05:30
|
|
|
permissions:
|
|
|
|
|
contents: read # for actions/checkout to fetch code
|
|
|
|
|
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
2022-11-04 20:45:41 +01:00
|
|
|
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
2021-10-21 16:18:11 -07:00
|
|
|
name: Analyze
|
|
|
|
|
runs-on: windows-latest
|
|
|
|
|
|
2021-10-21 14:14:02 -07:00
|
|
|
steps:
|
2021-10-21 16:18:11 -07:00
|
|
|
- name: Checkout repository
|
2024-01-03 02:09:21 -05:00
|
|
|
uses: actions/checkout@v4
|
2021-10-21 16:18:11 -07:00
|
|
|
|
2021-10-21 14:14:02 -07:00
|
|
|
- name: Configure CMake
|
2021-10-21 16:18:11 -07:00
|
|
|
run: cmake -B ${{ env.build }}
|
|
|
|
|
|
|
|
|
|
# Build is not required unless generated source files are used
|
|
|
|
|
# - name: Build CMake
|
|
|
|
|
# run: cmake --build ${{ env.build }}
|
2021-10-21 14:14:02 -07:00
|
|
|
|
|
|
|
|
- name: Initialize MSVC Code Analysis
|
2021-10-26 21:48:19 -07:00
|
|
|
uses: microsoft/msvc-code-analysis-action@04825f6d9e00f87422d6bf04e1a38b1f3ed60d99
|
2021-10-21 14:14:02 -07:00
|
|
|
# Provide a unique ID to access the sarif output path
|
|
|
|
|
id: run-analysis
|
|
|
|
|
with:
|
|
|
|
|
cmakeBuildDirectory: ${{ env.build }}
|
|
|
|
|
# Ruleset file that will determine what checks will be run
|
2021-10-26 21:37:36 -07:00
|
|
|
ruleset: NativeRecommendedRules.ruleset
|
2021-10-21 14:14:02 -07:00
|
|
|
|
|
|
|
|
# Upload SARIF file to GitHub Code Scanning Alerts
|
2021-10-21 16:18:11 -07:00
|
|
|
- name: Upload SARIF to GitHub
|
2024-04-25 13:24:02 -04:00
|
|
|
uses: github/codeql-action/upload-sarif@v3
|
2021-10-21 14:14:02 -07:00
|
|
|
with:
|
|
|
|
|
sarif_file: ${{ steps.run-analysis.outputs.sarif }}
|
|
|
|
|
|
|
|
|
|
# Upload SARIF file as an Artifact to download and view
|
|
|
|
|
# - name: Upload SARIF as an Artifact
|
2025-01-21 15:06:02 -05:00
|
|
|
# uses: actions/upload-artifact@v4
|
2021-10-21 14:14:02 -07:00
|
|
|
# with:
|
|
|
|
|
# name: sarif-file
|
|
|
|
|
# path: ${{ steps.run-analysis.outputs.sarif }}
|