Reorganize scripts #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Static Analysis | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
analyze: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential cmake libboost-all-dev cppcheck clang-tools | |
- name: Configure | |
run: | | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. | |
- name: Run static analysis with Cppcheck | |
run: | | |
cppcheck --enable=all --std=c++20 --inconclusive --xml --xml-version=2 --suppress=missingIncludeSystem \ | |
-DBOOST_ALL_DYN_LINK -I include src 2> cppcheck-report.xml | |
continue-on-error: true | |
- name: Generate Cppcheck HTML report | |
run: | | |
cppcheck-htmlreport --file=cppcheck-report.xml --report-dir=cppcheck-htmlreport | |
- name: Upload Cppcheck report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cppcheck-report | |
path: cppcheck-htmlreport | |
if-no-files-found: warn | |
- name: Run scan-build (Clang Static Analyzer) | |
run: | | |
mkdir -p scan-build-results | |
scan-build -o scan-build-results cmake --build build | |
continue-on-error: true | |
- name: Upload scan-build results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: scan-build-results | |
path: scan-build-results | |
if-no-files-found: warn | |
- name: Run include-what-you-use | |
run: | | |
sudo apt-get install -y iwyu | |
mkdir -p iwyu-build | |
cd iwyu-build | |
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. | |
python3 /usr/bin/iwyu_tool.py -p . > iwyu-report.txt || true | |
continue-on-error: true | |
- name: Upload IWYU results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: iwyu-report | |
path: iwyu-build/iwyu-report.txt | |
if-no-files-found: warn | |
- name: Summary | |
run: | | |
echo "## Static Analysis Summary" > static_analysis_summary.md | |
echo "Check the artifacts for detailed reports." >> static_analysis_summary.md | |
cat static_analysis_summary.md |