apply format, cpplint, cppcheck #368
This file contains hidden or 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
| # | |
| # .github/workflows/cpp-quality.yml | |
| # | |
| # SPDX-License-Identifier: MIT | |
| # SPDX-FileCopyrightText: 2026 Jens A. Koch. | |
| # This file is part of fifengine/fifechan. | |
| # | |
| name: "C++ Quality" | |
| on: | |
| - push | |
| - pull_request | |
| # You can manually run this workflow. | |
| - workflow_dispatch | |
| # improve CI concurrency by automatically cancelling outdated jobs | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| # --------------------------------------------------------------------------------------- | |
| clang-format: | |
| # --------------------------------------------------------------------------------------- | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🤘 Checkout Code | |
| uses: actions/checkout@v6 # https://github.com/actions/checkout | |
| - name: 🔽 Install dos2unix | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y dos2unix | |
| - name: 🔽 Install clang-format-20 | |
| run: | | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x ./llvm.sh | |
| sudo ./llvm.sh 20 | |
| sudo apt-get install -y clang-format-20 | |
| rm llvm.sh | |
| - name: 🛠️ Apply formatting | |
| run: | | |
| chmod +x build-tools/format.sh | |
| ./build-tools/format.sh | |
| #continue-on-error: true | |
| - name: 🛠️ Check git difference | |
| run: | | |
| git status | |
| git diff | |
| #continue-on-error: true | |
| # --------------------------------------------------------------------------------------- | |
| cpplint: | |
| # --------------------------------------------------------------------------------------- | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🤘 Checkout Code | |
| uses: actions/checkout@v6 # https://github.com/actions/checkout | |
| - name: 🔽 Setup Python | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install python3 python3-pip python3-venv grep | |
| - name: 🔽 Setup Python Virtual Env | |
| run: | | |
| export VIRTUAL_ENV=/opt/venv | |
| python3 -m venv $VIRTUAL_ENV | |
| export PATH="$VIRTUAL_ENV/bin:$PATH" | |
| - name: 🔽 Install cpplint | |
| run: | | |
| pip install --prefer-binary --no-cache-dir cpplint | |
| - name: 🛠️ Run cpplint | |
| run: | | |
| cpplint --recursive src include tests examples | |
| - name: 🛠️ Identify places where 'reinterpret_cast' is used | |
| run: | | |
| grep -rniw --include=\*.{cpp,hpp} "reinterpret_cast" src include tests examples | |
| # --------------------------------------------------------------------------------------- | |
| cppcheck: | |
| # --------------------------------------------------------------------------------------- | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🤘 Checkout Code | |
| uses: actions/checkout@v6 # https://github.com/actions/checkout | |
| - name: 🔽 Install cppcheck | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cppcheck | |
| - name: 🛠️ Run cppcheck | |
| run: | | |
| echo "Cppcheck version: $(cppcheck --version)" | |
| cppcheck \ | |
| --enable=warning,style,performance,portability \ | |
| --std=c++20 \ | |
| --quiet \ | |
| --inline-suppr \ | |
| --error-exitcode=1 \ | |
| -I include \ | |
| src examples tests | |
| #continue-on-error: true |