Fix issues reported by Coverity #3251
Workflow file for this run
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: Static analysis | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref_name != 'master' }} | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [opened, synchronize, reopened] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
clang-tidy-linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- build_args: -DPLGD_DEV_TIME_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_ENABLED=ON | |
- build_args: -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF -DOC_PUSH_ENABLED=OFF -DOC_JSON_ENCODER_ENABLED=OFF -DOC_DEBUG_ENABLED=ON | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- name: Install clang-17 and clang-tidy-17 | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install curl | |
curl -sL https://apt.llvm.org/llvm.sh > llvm.sh | |
chmod u+x llvm.sh | |
sudo ./llvm.sh 17 | |
sudo apt-get install clang-17 clang-tidy-17 | |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 200 | |
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 200 | |
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-17 200 | |
update-alternatives --verbose --display clang | |
- name: Build with clang and analyze with clang-tidy | |
run: | | |
mkdir build && cd build | |
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DOC_CLANG_TIDY_ENABLED=ON -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DOC_ETAG_ENABLED=ON -DOC_JSON_ENCODER_ENABLED=ON ${{ matrix.build_args }} -DBUILD_TESTING=OFF .. | |
cmake --build . |