Skip to content

Commit

Permalink
CI tidy checks
Browse files Browse the repository at this point in the history
  • Loading branch information
bgs99 committed May 11, 2024
1 parent 9e863d5 commit 2cd4dcc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,29 @@ jobs:
- name: Check formatting
run: python ${{ github.workspace }}/scripts/check_format.py --clang-format=clang-format-18

check-tidy:
runs-on: ubuntu-22.04
env:
build_dir: ${{ github.workspace }}/build
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Add LLVM apt key
run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm-toolchain-focal-18.asc

- name: Add LLVM repo
run: sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main'

- name: Install dependencies
run: sudo apt-get install libfmt-dev libpq-dev clang-tidy-18

- name: Configure CMake
run: cmake -B ${{ env.build_dir }} -S ${{ github.workspace }}

- name: Run clang-tidy
run: python ${{ github.workspace }}/scripts/tidy.py --clang-tidy=clang-tidy-18 --compile-commands=${{ env.build_dir }}

test:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
8 changes: 4 additions & 4 deletions scripts/tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

if __name__ == '__main__':
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument('--clang-format',
help='clang-format executable to use',
parser.add_argument('--clang-tidy',
help='clang-tidy executable to use',
type=str,
default='clang-format')
default='run-clang-tidy')
parser.add_argument('--compile-commands',
help='Path to the directory with compile commands',
type=Path,
default='build')

args = parser.parse_args()

subprocess.run(['run-clang-tidy', '-quiet', '-p', args.compile_commands.as_posix(),
subprocess.run([args.clang_tidy, '-quiet', '-p', args.compile_commands.as_posix(),
*[file.as_posix() for file in cpp_files()]])

0 comments on commit 2cd4dcc

Please sign in to comment.