version: 2
jobs:
  build:
    docker:
      - image: ubuntu:xenial
    steps:
      - checkout
      - run: |
          apt-get update
          apt-get install -y g++ cmake clang-format

      - run: |
          g++ --version
          cmake --version

      - restore_cache:
          key: dependency-cache-{{ .Branch }}-{{ checksum "CMakeLists.txt" }}

      - run: |
          find . \( -name '*.cc' -o -name '*.h' \) -type f -print0 | xargs -0 -P4 -I{} bash -c 'diff -u {} <(clang-format {})'
          mkdir -p build && cd build && cmake .. && make

      - save_cache:
          key: dependency-cache-{{ .Branch }}-{{ checksum "CMakeLists.txt" }}
          paths:
            - build

version: 2
jobs:
  build:
    docker:
      - image: ubuntu:xenial
    steps:
      - checkout
      - run: |
          apt-get update
          apt-get install -y g++ cmake clang-format clang-tidy

      - run: |
          g++ --version
          cmake --version

      - restore_cache:
          key: dependency-cache-{{ .Branch }}-{{ checksum "CMakeLists.txt" }}

      - run: |
          find . \( -name '*.cc' -o -name '*.h' \) -type f -print0 | xargs -0 -P4 -I{} bash -c 'diff -u {} <(clang-format {})'
          mkdir -p build && cd build && cmake .. && make clang-tidy && make

      - save_cache:
          key: dependency-cache-{{ .Branch }}-{{ checksum "CMakeLists.txt" }}
          paths:
            - build

Configure circleci to run clang-tidy
Configure circleci to run clang-tidy
