|
| 1 | +# Security scanning with Microsoft C++ Code Analysis. |
| 2 | +# Checks any master integration and publish warnings into security GitHub tab. |
| 3 | +# |
| 4 | +# Find more information at: |
| 5 | +# https://github.com/microsoft/msvc-code-analysis-action |
| 6 | + |
| 7 | +name: Microsoft C++ Code Analysis |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - 'master' |
| 13 | + |
| 14 | +env: |
| 15 | + # Path to the CMake build directory. |
| 16 | + build: '${{ github.workspace }}/build' |
| 17 | + config: 'Debug' |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +jobs: |
| 23 | + analyze: |
| 24 | + permissions: |
| 25 | + contents: read # for actions/checkout to fetch code |
| 26 | + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results |
| 27 | + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status |
| 28 | + name: Analyze |
| 29 | + runs-on: windows-latest |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout repository |
| 33 | + |
| 34 | + |
| 35 | + - name: Install dependencies |
| 36 | + run: | |
| 37 | + choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y |
| 38 | + choco install magicsplat-tcl-tk -y |
| 39 | + |
| 40 | + - name: Configure CMake |
| 41 | + run: | |
| 42 | + mkdir build |
| 43 | + cd build |
| 44 | + cmake -D USE_FREETYPE=OFF -DCMAKE_BUILD_TYPE=${{ env.config }} .. |
| 45 | +
|
| 46 | + - name: Run MSVC Code Analysis |
| 47 | + |
| 48 | + # Provide a unique ID to access the sarif output path |
| 49 | + id: run-analysis |
| 50 | + with: |
| 51 | + cmakeBuildDirectory: ${{ env.build }} |
| 52 | + buildConfiguration: ${{ env.config }} |
| 53 | + # Ruleset file that will determine what checks will be run |
| 54 | + ruleset: NativeRecommendedRules.ruleset |
| 55 | + # Paths to ignore analysis of CMake targets and includes |
| 56 | + # ignoredPaths: ${{ github.workspace }}/dependencies;${{ github.workspace }}/test |
| 57 | + |
| 58 | + # Upload SARIF file to GitHub Code Scanning Alerts |
| 59 | + #- name: Upload SARIF to GitHub |
| 60 | + # uses: github/codeql-action/[email protected] |
| 61 | + # with: |
| 62 | + # sarif_file: ${{ steps.run-analysis.outputs.sarif }} |
| 63 | + |
| 64 | + # Upload SARIF file as an Artifact to download and view |
| 65 | + - name: Upload SARIF as an Artifact |
| 66 | + |
| 67 | + with: |
| 68 | + name: sarif-file |
| 69 | + path: ${{ steps.run-analysis.outputs.sarif }} |
0 commit comments