## Copyright 2024-2026 Intel Corporation
## SPDX-License-Identifier: BSD-3-Clause

name: Lint code with clang-tidy

permissions: read-all

on:
  pull_request:
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  clang_tidy:
    runs-on: ubuntu-24.04

    steps:
    - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
      with:
        submodules: true

    - name: Install dependencies
      run: |
        .github/workflows/scripts/install-build-deps.sh

    - name: Build package
      run: |
        .github/workflows/scripts/build-ispc.sh

    - name: Run clang-tidy
      run: |
        set -o pipefail
        ./scripts/clang_tidy.sh 2>&1 | tee clang-tidy.log

    - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
      with:
        name: clang-tidy-log
        path: |
          clang-tidy.log
