forked from CoatiSoftware/Sourcetrail
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: clang-tidy | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
clang-tidy: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: "true" | ||
|
||
- name: Get tags | ||
run: git fetch --tags origin | ||
|
||
- name: Install dependencies | ||
run: sudo apt install -y build-essential cmake qtbase5-dev libqt5svg5-dev python3-pip grep make | ||
|
||
- name: Install conan2 | ||
run: | | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
pip install conan | ||
- name: Cache Conan packages (Ubuntu) | ||
if: runner.os == 'Linux' | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.conan2 | ||
key: conan-ubuntu-24.04-gnu-${{ hashFiles('**/conanfile.txt') }} | ||
|
||
- name: Cache Conan packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.conan2 | ||
key: conan-ubuntu-24.04-gnu-${{ hashFiles('**/conanfile.txt') }} | ||
|
||
- name: Configure CMake | ||
run: cmake -B build -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".conan/gcc/build/Release/generators/conan_toolchain.cmake" . | ||
|
||
- name: Run clang-tidy | ||
run: | | ||
FILES=$(git diff --name-only origin/main | grep -E '\.(cpp|h|hpp)$') | ||
if [ -n "$FILES" ]; then | ||
clang-tidy \ | ||
-p ${{ github.workspace }}/build/compile_commands.json \ | ||
--config-file=.clang-tidy \ | ||
--quiet \ | ||
--format-style=file \ | ||
"$FILES" | ||
fi |
This file contains 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