[llvm] [GitHub][CI] Add clang-tidy premerge workflow (PR #154829)
Baranov Victor via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 27 06:49:20 PDT 2025
================
@@ -0,0 +1,126 @@
+name: "Code lint"
+
+permissions:
+ contents: read
+
+on:
+ pull_request:
+ branches:
+ - main
+ - 'users/**'
+ paths:
+ - 'clang-tools-extra/clang-tidy/**'
+
+jobs:
+ code_linter:
+ if: github.repository_owner == 'llvm'
+ runs-on: ubuntu-24.04
+ defaults:
+ run:
+ shell: bash
+ container:
+ image: 'ghcr.io/llvm/ci-ubuntu-24.04:latest'
+ timeout-minutes: 60
+ concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+ steps:
+ - name: Fetch LLVM sources
+ uses: actions/checkout at b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+ with:
+ fetch-depth: 2
+
+ - name: Get changed files
+ id: changed-files
+ uses: step-security/changed-files at 3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
+ with:
+ separator: ","
+ skip_initial_fetch: true
+ base_sha: 'HEAD~1'
+ sha: 'HEAD'
+
+ - name: Listed files
+ env:
+ CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
+ run: |
+ echo "Changed files:"
+ echo "$CHANGED_FILES"
+
+ - name: Fetch code linting utils
+ uses: actions/checkout at 08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ repository: ${{ github.repository }}
+ ref: ${{ github.base_ref }}
+ sparse-checkout: |
+ llvm/utils/git/code-lint-helper.py
+ llvm/utils/git/requirements_linting.txt
+ clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
+ sparse-checkout-cone-mode: false
+ path: code-lint-tools
+
+ - uses: actions/setup-python at v5
+ id: setup_python
+ with:
+ python-version: '3.12'
+
+ - name: Install dependencies
+ run: |
+ python3 -m venv .venv
+ source .venv/bin/activate
+ python3 -m pip install -r code-lint-tools/llvm/utils/git/requirements_linting.txt
----------------
vbvictor wrote:
Even being first step it errors without cleaning cache first:
https://github.com/llvm/llvm-project/actions/runs/17268421138/job/49006216899?pr=154223
I used the same versions as in pr-format.
P.S. first step with lsb_release needs because of https://github.com/actions/setup-python/issues/688.
In real workflow, this package comes from `install clang-format` or `install clang-tidy` steps.
https://github.com/llvm/llvm-project/pull/154829
More information about the llvm-commits
mailing list