Skip to content

Commit 449b849

Browse files
committed
added static analysis stage and CMakePreset
1 parent bd9d84c commit 449b849

2 files changed

Lines changed: 75 additions & 0 deletions

File tree

.github/workflows/build_cmake.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,60 @@ jobs:
8181
- name: Test
8282
shell: bash
8383
run: ctest --preset test-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}
84+
85+
linux-static_analysis:
86+
name: Static Analysis, ${{ matrix.os }}, ${{ matrix.compiler.name }}, ${{ matrix.buildtype }}
87+
runs-on: ${{ matrix.os }}
88+
strategy:
89+
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix entry fails.
90+
matrix:
91+
os: [ubuntu-22.04]
92+
buildtype: [debug]
93+
compiler: [{name: 'Clang 15', preset: clang-15, pkgs: 'clang-15 llvm-15 llvm-15-dev libclang-15-dev', iwyu_branch: 'clang_15', path_prefix: "/usr/lib/llvm-15"}]
94+
95+
steps:
96+
- uses: actions/checkout@v3
97+
98+
- name: Cache
99+
uses: actions/cache@v3
100+
env:
101+
cache-name: cache-conan-modules
102+
with:
103+
path: |
104+
${{ env.CONAN_USER_HOME }}
105+
~/.cache/pip
106+
key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Conan.cmake') }}
107+
108+
- name: Install conan
109+
shell: bash
110+
run: |
111+
python3 -m pip install --upgrade pip setuptools conan==1.59
112+
source ~/.profile
113+
114+
- name: Install dependencies
115+
run: |
116+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
117+
sudo apt update
118+
sudo apt install ninja-build ${{ matrix.compiler.pkgs }} cppcheck
119+
shell: bash
120+
121+
- name: Compile and install IWYU
122+
run: |
123+
mkdir iwyu && cd iwyu
124+
git clone https://github.com/include-what-you-use/include-what-you-use.git
125+
cd include-what-you-use
126+
git checkout ${{ matrix.compiler.iwyu_branch }}
127+
cd ..
128+
mkdir build && cd build
129+
cmake -G "Ninja" -DCMAKE_PREFIX_PATH=${{ matrix.compiler.path_prefix }} ../include-what-you-use
130+
ninja
131+
sudo ninja install
132+
shell: bash
133+
134+
- name: Configure via CMake
135+
shell: bash
136+
run: cmake --preset unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}-static-analysis
137+
138+
- name: Build
139+
shell: bash
140+
run: cmake --build --preset build-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}-static-analysis

CMakePresets.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,20 @@
304304
"CMAKE_CXX_COMPILER": "g++.exe",
305305
"CMAKE_BUILD_TYPE": "Release"
306306
}
307+
},
308+
{
309+
"name": "unixlike-clang-15-debug-static-analysis",
310+
"displayName": "Clang 15 Debug - Static Analysis",
311+
"description": "Target Unix-like OS with the Clang 15 compiler, debug build type",
312+
"inherits": "unixlike-clang-15-debug",
313+
"cacheVariables": {
314+
"CMAKE_C_COMPILER": "clang-15",
315+
"CMAKE_CXX_COMPILER": "clang++-15",
316+
"CMAKE_BUILD_TYPE": "Debug",
317+
"ENABLE_CPPCHECK": "ON",
318+
"ENABLE_CLANG_TIDY": "ON",
319+
"ENABLE_INCLUDE_WHAT_YOU_USE": "ON"
320+
}
307321
}
308322
],
309323
"buildPresets": [
@@ -386,6 +400,10 @@
386400
{
387401
"name": "build-win32-gcc-x64-mingw-release",
388402
"configurePreset": "win32-gcc-x64-mingw-release"
403+
},
404+
{
405+
"name": "build-unixlike-clang-15-debug-static-analysis",
406+
"configurePreset": "unixlike-clang-15-debug-static-analysis"
389407
}
390408
],
391409
"testPresets": [

0 commit comments

Comments
 (0)