♻️ modernize and update the project #475
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: cpp-linter | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
merge_group: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: 🚨 Lint | |
runs-on: ubuntu-latest | |
env: | |
clang-version: 19 | |
steps: | |
# check out the repository (including submodules) | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install boost | |
run: sudo apt-get update && sudo apt-get -y install libboost-all-dev | |
- name: Install clang-${{ env.clang-version }} | |
run: | | |
sudo apt-get update | |
wget https://apt.llvm.org/llvm.sh -O ${{ runner.temp }}/llvm_install.sh | |
chmod +x ${{ runner.temp }}/llvm_install.sh | |
if sudo ${{ runner.temp }}/llvm_install.sh ${{ env.clang-version }}; then | |
sudo apt-get install -y clang-format-${{ env.clang-version }} clang-tidy-${{ env.clang-version }} || exit 1 | |
else | |
echo "Installation from script failed." | |
exit 1 | |
fi | |
echo "CC=clang-${{ env.clang-version }}" >> $GITHUB_ENV | |
echo "CXX=clang++-${{ env.clang-version }}" >> $GITHUB_ENV | |
# generate a compilation database (assumes that the CMake project has `CMAKE_EXPORT_COMPILE_COMMANDS` set) | |
- name: Generate compilation database | |
run: | | |
echo $CC | |
echo $CXX | |
$CC --version | |
$CXX --version | |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug | |
# runs the cpp-linter action using the generated compilation database and the specified clang version | |
- name: Run cpp-linter | |
uses: cpp-linter/cpp-linter-action@v2 | |
id: linter | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
style: "" | |
tidy-checks: "" | |
version: ${{ env.clang-version }} | |
ignore: "build|include/python|src/python" | |
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }} | |
step-summary: true | |
database: "build" | |
extra-args: -std=c++17 | |
files-changed-only: true | |
- name: Fail if linter found errors | |
if: steps.linter.outputs.checks-failed > 0 | |
run: echo "Linter found errors" && exit 1 |