-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add static checker for cpp with cppcheck #2346
Changes from 3 commits
84e5730
197f71e
df1b9d6
4f589a2
2878f72
1ceb7e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,6 +7,33 @@ on: | |||||||||||||||||||
branches: [ main ] | ||||||||||||||||||||
|
||||||||||||||||||||
jobs: | ||||||||||||||||||||
cppcheck_analyser: | ||||||||||||||||||||
name: static check with cppcheck | ||||||||||||||||||||
runs-on: ubuntu-latest | ||||||||||||||||||||
steps: | ||||||||||||||||||||
- uses: actions/checkout@v4 | ||||||||||||||||||||
with: | ||||||||||||||||||||
submodules: 'recursive' | ||||||||||||||||||||
- name: setup | ||||||||||||||||||||
env: | ||||||||||||||||||||
CC: /usr/bin/gcc-10 | ||||||||||||||||||||
CXX: /usr/bin/g++-10 | ||||||||||||||||||||
run: | | ||||||||||||||||||||
sudo -E ./ci/setup_cmake.sh | ||||||||||||||||||||
sudo -E ./ci/setup_ci_environment.sh | ||||||||||||||||||||
sudo apt-get -y install cmake | ||||||||||||||||||||
- name: build and run cppcheck | ||||||||||||||||||||
run: | | ||||||||||||||||||||
cd .. | ||||||||||||||||||||
git clone https://github.com/danmar/cppcheck.git --branch 2.12.x | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the |
||||||||||||||||||||
cd cppcheck | ||||||||||||||||||||
mkdir build | ||||||||||||||||||||
cd build | ||||||||||||||||||||
cmake .. | ||||||||||||||||||||
cmake --build . | ||||||||||||||||||||
chmod +x bin/cppcheck | ||||||||||||||||||||
cd ../../opentelemetry-cpp | ||||||||||||||||||||
../cppcheck/build/bin/cppcheck -ithird_party/ --error-exitcode=1 . | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have this CI similar to that for opentelemetry-cpp/.github/workflows/ci.yml Lines 678 to 686 in 11d5d9e
This will also allow developers to invoke static analysis locally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And should |
||||||||||||||||||||
cmake_test: | ||||||||||||||||||||
name: CMake test (without otlp-exporter) | ||||||||||||||||||||
runs-on: ubuntu-latest | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should cmake install already handled by
./ci/setup_cmake.sh
2 lines above?