Skip to content

Commit 2157e33

Browse files
authored
Update workflow
* Update workflow
1 parent 20ed000 commit 2157e33

File tree

4 files changed

+51
-15
lines changed

4 files changed

+51
-15
lines changed

.clang-tidy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Checks: '-*,readability-*,performance-*'
2+
WarningsAsErrors: ''
3+
HeaderFilterRegex: '.*'
4+
AnalyzeTemporaryDtors: false

.github/workflows/codacy.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,15 @@ jobs:
3838
- name: Checkout code
3939
uses: actions/checkout@v4
4040

41+
- name: Configure and Build CMake
42+
run: |
43+
cmake -B build
44+
cmake --build build
45+
4146
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
4247
- name: Run Codacy Analysis CLI
4348
uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b
49+
continue-on-error: true
4450
with:
4551
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
4652
# You can also omit the token and run the tools that support default configurations
@@ -54,9 +60,10 @@ jobs:
5460
# This will handover control about PR rejection to the GitHub side
5561
max-allowed-issues: 2147483647
5662

57-
# Upload the SARIF file generated in the previous step
58-
- name: Upload SARIF results file
59-
uses: github/codeql-action/upload-sarif@v3
60-
with:
61-
sarif_file: results.sarif
62-
category: 'codacy'
63+
# # Upload the SARIF file generated in the previous step
64+
# - name: Upload SARIF results file
65+
# uses: github/codeql-action/upload-sarif@v4
66+
# if: always()
67+
# with:
68+
# sarif_file: results.sarif
69+
# category: '${{ github.workflow }}-codacy'

.github/workflows/codeql.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,3 @@ jobs:
9090
uses: github/codeql-action/analyze@v3
9191
with:
9292
category: '/language:${{matrix.language}}'
93-
94-
- name: Upload Results
95-
uses: github/codeql-action/upload-sarif@v3
96-
with:
97-
category: 'codeql-${{matrix.language}}-${{ matrix.build-mode }}'

.github/workflows/msvc.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ jobs:
3939
- name: Configure CMake
4040
run: cmake -B ${{ env.build }}
4141

42-
# Build is not required unless generated source files are used
43-
# - name: Build CMake
44-
# run: cmake --build ${{ env.build }}
42+
- name: Build CMake
43+
run: cmake --build ${{ env.build }}
4544

4645
- name: Initialize MSVC Code Analysis
4746
uses: microsoft/msvc-code-analysis-action@04825f6d9e00f87422d6bf04e1a38b1f3ed60d99
@@ -52,12 +51,43 @@ jobs:
5251
# Ruleset file that will determine what checks will be run
5352
ruleset: NativeRecommendedRules.ruleset
5453

54+
- name: Consolidate SARIF
55+
shell: powershell
56+
run: |
57+
$sarif = Get-Content "${{ steps.run-analysis.outputs.sarif }}" -Raw | ConvertFrom-Json
58+
59+
# Merge all runs into the first run
60+
if ($sarif.runs.Count -gt 1) {
61+
$firstRun = $sarif.runs[0]
62+
for ($i = 1; $i -lt $sarif.runs.Count; $i++) {
63+
$firstRun.results += $sarif.runs[$i].results
64+
}
65+
$sarif.runs = @($firstRun)
66+
}
67+
68+
$sarif | ConvertTo-Json -Depth 100 | Set-Content "${{ steps.run-analysis.outputs.sarif }}"
69+
70+
# - name: Merge SARIF runs
71+
# run: |
72+
# pip install sarif-tools
73+
# python -c "
74+
# import json, glob
75+
# merged = {'version':'2.1.0','runs':[]}
76+
# for f in glob.glob('build/*.sarif'):
77+
# with open(f) as s:
78+
# merged['runs'] += json.load(s)['runs']
79+
# with open('build/results.sarif','w') as out:
80+
# json.dump(merged, out)
81+
# "
82+
83+
5584
# Upload SARIF file to GitHub Code Scanning Alerts
5685
- name: Upload SARIF to GitHub
57-
uses: github/codeql-action/upload-sarif@v3
86+
uses: github/codeql-action/upload-sarif@v4
5887
with:
5988
sarif_file: ${{ steps.run-analysis.outputs.sarif }}
6089
category: 'msvc-cpp'
90+
6191

6292
# Upload SARIF file as an Artifact to download and view
6393
# - name: Upload SARIF as an Artifact

0 commit comments

Comments
 (0)