-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI setup that performs code analysis and build checks (#14)
* Add CI setup that performs code analysis and build checks * Fix cmake indentation
- Loading branch information
1 parent
b62c122
commit 170b2ee
Showing
3 changed files
with
85 additions
and
26 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,62 @@ | ||
name: C++ CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Set up C++ toolchain | ||
- name: Install dependencies | ||
run: sudo apt-get update && sudo apt-get install -y build-essential cmake cppcheck clang-format | ||
- name: Install Qt | ||
uses: jurplel/install-qt-action@v4 | ||
with: | ||
version: '6.5.*' | ||
|
||
# Run static code analysis using cppcheck | ||
- name: Static analysis (cppcheck) | ||
run: | | ||
cppcheck --enable=all --inconclusive --std=c++17 --force . 2> cppcheck-report.txt || true | ||
# Upload cppcheck results as an artifact (Corrected indentation) | ||
- name: Upload cppcheck report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cppcheck-report | ||
path: cppcheck-report.txt | ||
|
||
# Run linting on C++ files using clang-format | ||
- name: Lint C++ files (clang-format) | ||
run: | | ||
find . -name '*.cpp' -o -name '*.hpp' | xargs clang-format -i | ||
# Run linting on CMake files using cmakelint | ||
- name: Install pip and cmakelint | ||
run: | | ||
sudo apt-get install -y python3-pip | ||
pip install cmakelint | ||
- name: Lint CMake files | ||
run: | | ||
find . -name 'CMakeLists.txt' -o -name '*.cmake' | xargs cmakelint --linelength=120 | ||
# Build the project using CMake | ||
- name: Create build directory | ||
run: mkdir build | ||
|
||
- name: Configure with CMake | ||
run: cmake -S . -B build | ||
|
||
- name: Build with CMake | ||
run: cmake --build build |
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
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