name: clang-tidy

on:
  push:
    paths-ignore:
      - 'README.md'
      - 'CHANGELOG.md'
      - 'doc/**'
  pull_request:
    paths-ignore:
      - 'README.md'
      - 'CHANGELOG.md'
      - 'doc/**'

jobs:
  clang-tidy:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
      with:
        submodules: recursive

    - run: sudo apt-get install -yq clang-tidy

    - run: find include/ -name '*.hpp' | xargs -I '{}' clang-tidy --quiet '{}' -- --std=c++17 -Iinclude -Iinclude/jsoncons -Iinclude/jsoncons_ext

    - run: find test/ -name '*.cpp' | xargs -I '{}' clang-tidy --quiet '{}' -- --std=c++17 -Iinclude -Iinclude/jsoncons -Iinclude/jsoncons_ext -Itest/thirdparty
