Run analyzers #11
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
name: Run analyzers | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
cppcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install cppcheck | |
- name: Configure | |
run: | | |
cmake -S . -B build \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
-DBUILD_PYTHON=OFF \ | |
-DBUILD_TESTING=OFF | |
- name: Run cppcheck | |
run: | | |
cppcheck \ | |
--enable=style,portability,performance,warning \ | |
--library=posix \ | |
--library=cppcheck/segyio.cfg \ | |
--suppressions-list=cppcheck/suppressions.txt \ | |
--inline-suppr \ | |
--project=build/compile_commands.json \ | |
--error-exitcode=1 | |
scan_build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install clang clang-tools libfindbin-libs-perl | |
- name: Configure segyio | |
run: | | |
sudo scan-build --status-bugs -v \ | |
cmake \ | |
-S . \ | |
-B build \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DBUILD_PYTHON=OFF \ | |
-DBUILD_TESTING=OFF | |
- name: Run scan-build | |
run: | | |
sudo scan-build --status-bugs -v \ | |
cmake \ | |
--build build \ | |
--target install | |
valgrind: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install valgrind | |
- name: Build segyio | |
run: | | |
cmake -S . -B build \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DCMAKE_C_FLAGS_DEBUG="-O0" \ | |
-DCMAKE_CXX_FLAGS_DEBUG="-O0" \ | |
-DBUILD_SHARED_LIBS=ON \ | |
-DBUILD_PYTHON=OFF | |
cmake --build build | |
- name: Run valgrind on C tests, file | |
working-directory: build/lib | |
run: | | |
valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./c.segy "[c.segy]" | |
- name: Run valgrind on C tests, mmap | |
working-directory: build/lib | |
run: | | |
valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./c.segy "[c.segy]" "--test-mmap" | |
- name: Run valgrind on C++ tests | |
working-directory: build/lib | |
run: | | |
valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./c.segy "[c++]" |