Skip to content

Commit 91cea49

Browse files
committed
Add linter analysis workflow
1 parent 7a7d44d commit 91cea49

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/analysis.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: cpp-linter-analysis
2+
3+
on: [push, pull_request]
4+
5+
defaults:
6+
run:
7+
shell: bash -e -l {0}
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-24.04
12+
13+
steps:
14+
# Set up Clang and LLVM
15+
- name: Install LLVM and Clang
16+
run: |
17+
wget https://apt.llvm.org/llvm.sh
18+
chmod +x llvm.sh
19+
sudo ./llvm.sh 20
20+
sudo apt-get install -y clang-tools-20
21+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-20 200
22+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-20 200
23+
sudo update-alternatives --install /usr/bin/clang-scan-deps clang-scan-deps /usr/bin/clang-scan-deps-20 200
24+
sudo update-alternatives --set clang /usr/bin/clang-20
25+
sudo update-alternatives --set clang++ /usr/bin/clang++-20
26+
sudo update-alternatives --set clang-scan-deps /usr/bin/clang-scan-deps-20
27+
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
# Set conda environment using setup-micromamba
32+
- name: Set conda environment
33+
uses: mamba-org/setup-micromamba@main
34+
with:
35+
environment-name: myenv
36+
environment-file: environment-dev.yml
37+
init-shell: bash
38+
cache-downloads: true
39+
40+
# Run CMake configuration
41+
- name: Configure using CMake
42+
run: |
43+
export CC=clang; export CXX=clang++
44+
cmake -G Ninja \
45+
-Bbuild \
46+
-DCMAKE_BUILD_TYPE=Release \
47+
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
48+
-DBUILD_TESTS=ON \
49+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
50+
#-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING
51+
52+
# Run Clang-Tidy and Clang-Format Analysis
53+
- name: Run C++ analysis
54+
uses: cpp-linter/cpp-linter-action@v2
55+
id: linter
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
version: 20
60+
files-changed-only: false # check all files
61+
database: 'build'
62+
style: 'file' # Use .clang-format config file
63+
tidy-checks: '' # Use .clang-tidy config file
64+
step-summary: true
65+
ignore: 'build'
66+
extra-args: '-std=c++20'

0 commit comments

Comments
 (0)