|
| 1 | +name: Clang CIR clang-tidy linting |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - 'main' |
| 11 | + paths: |
| 12 | + - 'clang/lib/CIR/FrontendAction/**' |
| 13 | + - '.github/workflows/clang-cir-lint.yml' |
| 14 | + pull_request: |
| 15 | + branches: |
| 16 | + - '**' |
| 17 | + paths: |
| 18 | + - 'clang/lib/CIR/FrontendAction/**' |
| 19 | + - '.github/workflows/clang-cir-lint.yml' |
| 20 | + |
| 21 | +concurrency: |
| 22 | + # Skip intermediate builds: always. |
| 23 | + # Cancel intermediate builds: only if it is a pull request build. |
| 24 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 25 | + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} |
| 26 | + |
| 27 | +jobs: |
| 28 | + code_linter: |
| 29 | + runs-on: ubuntu-24.04 |
| 30 | + steps: |
| 31 | + - name: Fetch LLVM sources |
| 32 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 33 | + with: |
| 34 | + fetch-depth: 2 |
| 35 | + - name: Configure and CodeGen |
| 36 | + run: | |
| 37 | + cmake -G Ninja \ |
| 38 | + -B build \ |
| 39 | + -S llvm \ |
| 40 | + -DLLVM_ENABLE_ASSERTIONS=OFF \ |
| 41 | + -DLLVM_ENABLE_PROJECTS="clang;mlir" \ |
| 42 | + -DCMAKE_CXX_COMPILER=clang++ \ |
| 43 | + -DCMAKE_C_COMPILER=clang \ |
| 44 | + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ |
| 45 | + -DLLVM_INCLUDE_TESTS=OFF \ |
| 46 | + -DCLANG_INCLUDE_TESTS=OFF \ |
| 47 | + -DMLIR_INCLUDE_TESTS=OFF \ |
| 48 | + -DCMAKE_BUILD_TYPE=Release |
| 49 | + -DLLVM_TARGETS_TO_BUILD=host |
| 50 | +
|
| 51 | + ninja -C build |
| 52 | +
|
| 53 | + - name: Install clang-tidy |
| 54 | + uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1 |
| 55 | + with: |
| 56 | + clang-tidy: 20.1.8 |
| 57 | + |
| 58 | + - name: Setup Python env |
| 59 | + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 |
| 60 | + with: |
| 61 | + python-version: '3.12' |
| 62 | + |
| 63 | + |
| 64 | + - name: Run run-clang-tidy |
| 65 | + run: | |
| 66 | + ./clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \ |
| 67 | + -p build '(clang/lib/CIR/FrontendAction)' \ |
| 68 | + -checks="-*,readability-identifier-naming" \ |
| 69 | + -warnings-as-errors="-*,readability-identifier-naming" \ |
| 70 | + -j $(nproc) |
0 commit comments