Skip to content

Jump into C++23

Jump into C++23 #52

Workflow file for this run

name: 'C++ Lint'
on:
pull_request:
types: [opened, reopened] # let PR-synchronize events be handled by push events
push:
workflow_dispatch:
jobs:
cpp-lint:
runs-on: ubuntu-24.04
env:
# must be clang for clang-tidy!
cmake_CXX: clang++
conan_profile: clang
cmake_configure_preset: clang
steps:
- name: Install basic dependencies
run: |
sudo apt-get update && sudo apt-get install --no-install-recommends -y \
cmake ninja-build clang clang-tools
- name: Checkout Repo
uses: actions/checkout@v4
with:
submodules: true
- name: Set Github runner's env (CXX=${{ env.cmake_CXX }})
run: |
{
echo CXX=${{ env.cmake_CXX }}
} >> "$GITHUB_ENV"
- name: Install Conan package manager
id: conan2
run: |
pip --disable-pip-version-check --no-cache-dir install pipx
pipx install virtualenv conan
- name: Cache Conan2' dependencies
id: conan2-cache
uses: actions/cache@v4
with:
key: linux-${{ env.conan_profile }}-conan-${{ hashFiles('conanfile.py') }}
path: |
~/.conan2
- name: Create Conan2 profile
if: steps.conan2-cache.outputs.cache-hit != 'true'
# note, no build required for linting
run: |
conan profile detect --force --name ${{ env.conan_profile }}
cp ~/.conan2/profiles/${{ env.conan_profile }} ~/.conan2/profiles/default
- name: Conan install
run: |
virtualenv .venv
source .venv/bin/activate
pip install multipledispatch
python3 conan_install.py --profile ${{ env.conan_profile }}
deactivate
- name: CMake configuration
run: |
cmake --preset ${{ env.cmake_configure_preset }}
# no build required for lint
- name: Run cpp-linter (clang-format & clang-tidy)
id: cpp-linter
uses: cpp-linter/cpp-linter-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: 18
ignore: '.github|scripts|docs'
style: 'file' # Use .clang-format config file
tidy-checks: '' # appended to the value of the 'Checks' option in a .clang-tidy file
database: build # directory containing compilation database (like compile_commands.json) file.
# only 'update' a single comment in a pull request thread.
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
- name: Check for passed C++ checks
if: steps.cpp-linter.outputs.checks-failed > 0
run: |
echo "Some files failed the Clang tidy/format checks!"