From f4e3ea586cf6b8284d57728ec4da022a168e5890 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 27 Sep 2025 23:46:58 +0300 Subject: [PATCH 1/9] deleteme: violate clang-format to run job --- clang-tools-extra/clang-tidy/ClangTidy.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp index 7e18f3806a143..385c7adc6e0c2 100644 --- a/clang-tools-extra/clang-tidy/ClangTidy.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp @@ -270,8 +270,7 @@ class ErrorReporter { const llvm::StringMap &Fix) { for (const auto &FileAndReplacements : Fix) { for (const auto &Repl : FileAndReplacements.second) { - if (!Repl.isApplicable()) - continue; + if (!Repl.isApplicable()) continue; FileByteRange FBR; FBR.FilePath = Repl.getFilePath().str(); FBR.FileOffset = Repl.getOffset(); From fc8182b3d74c8417c13e70d5d1ee05b5ebd6e9bd Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 27 Sep 2025 23:56:40 +0300 Subject: [PATCH 2/9] new job --- .github/workflows/pr-code-format.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 61c8680cd72a1..bb04bb352e2bc 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -12,6 +12,8 @@ on: jobs: code_formatter: runs-on: ubuntu-24.04 + container: + image: 'ghcr.io/llvm/ci-ubuntu-24.04:latest' timeout-minutes: 30 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} @@ -39,14 +41,6 @@ jobs: echo "Formatting files:" echo "$CHANGED_FILES" - # The clang format version should always be upgraded to the first version - # of a release cycle (x.1.0) or the last version of a release cycle, or - # if there have been relevant clang-format backports. - - name: Install clang-format - uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1 - with: - clangformat: 21.1.0 - - name: Setup Python env uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: From 34113e7b8135cc98e246c5d271969952ab6d376b Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 28 Sep 2025 00:00:38 +0300 Subject: [PATCH 3/9] wip --- .github/workflows/pr-code-format.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index bb04bb352e2bc..dbc4096857b20 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -45,8 +45,6 @@ jobs: uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: python-version: '3.11' - cache: 'pip' - cache-dependency-path: 'llvm/utils/git/requirements_formatting.txt' - name: Install python dependencies run: pip install -r llvm/utils/git/requirements_formatting.txt From d20944b11c95d4b1730f142fc501809be2b52e03 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 28 Sep 2025 00:04:55 +0300 Subject: [PATCH 4/9] WIP --- .github/workflows/pr-code-format.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index dbc4096857b20..e602eed5d5fca 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -41,13 +41,8 @@ jobs: echo "Formatting files:" echo "$CHANGED_FILES" - - name: Setup Python env - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 - with: - python-version: '3.11' - - name: Install python dependencies - run: pip install -r llvm/utils/git/requirements_formatting.txt + run: pip install -r llvm/utils/git/requirements_formatting.txt --break-system-packages - name: Run code formatter env: From 1ce93d734a5b8db374ac0584d9a451cb9278374a Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 28 Sep 2025 13:42:50 +0300 Subject: [PATCH 5/9] better --- .github/workflows/pr-code-format.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index e602eed5d5fca..115ea24baad34 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -40,9 +40,14 @@ jobs: run: | echo "Formatting files:" echo "$CHANGED_FILES" + + - name: Create python venv + run: | + python -m venv venv + . venv/bin/activate - name: Install python dependencies - run: pip install -r llvm/utils/git/requirements_formatting.txt --break-system-packages + run: pip install -r llvm/utils/git/requirements_formatting.txt - name: Run code formatter env: From 0b99df62014b94aa7743347092688f22f155e7fe Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 28 Sep 2025 13:47:47 +0300 Subject: [PATCH 6/9] better --- .github/workflows/pr-code-format.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 115ea24baad34..841b601ed3f4f 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -44,10 +44,9 @@ jobs: - name: Create python venv run: | python -m venv venv - . venv/bin/activate - name: Install python dependencies - run: pip install -r llvm/utils/git/requirements_formatting.txt + run: venv/bin/pip install -r llvm/utils/git/requirements_formatting.txt - name: Run code formatter env: @@ -56,7 +55,7 @@ jobs: # Create an empty comments file so the pr-write job doesn't fail. run: | echo "[]" > comments && - python ./llvm/utils/git/code-format-helper.py \ + venv/bin/python ./llvm/utils/git/code-format-helper.py \ --write-comment-to-file \ --token ${{ secrets.GITHUB_TOKEN }} \ --issue-number $GITHUB_PR_NUMBER \ From 85eb2e3b7a34313bad42cafdb4fde044b7f92729 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 28 Sep 2025 14:14:31 +0300 Subject: [PATCH 7/9] violate python codestyle --- llvm/utils/git/code-lint-helper.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/llvm/utils/git/code-lint-helper.py b/llvm/utils/git/code-lint-helper.py index 1232f3ab0d370..ccd4ecd29c61e 100755 --- a/llvm/utils/git/code-lint-helper.py +++ b/llvm/utils/git/code-lint-helper.py @@ -206,10 +206,8 @@ def run_clang_tidy(changed_files: List[str], args: LintArgs) -> Optional[str]: proc = subprocess.run( tidy_diff_cmd, input=diff_content, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - text=True, - check=False, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + text=True, check=False, ) return clean_clang_tidy_output(proc.stdout.strip()) From d86f5a857024a299486ddf83d3c803059faca0f6 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 28 Sep 2025 14:22:25 +0300 Subject: [PATCH 8/9] add activate --- .github/workflows/pr-code-format.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 841b601ed3f4f..82e7f6ac3fdff 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -54,6 +54,7 @@ jobs: CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} # Create an empty comments file so the pr-write job doesn't fail. run: | + . venv/bin/activate && echo "[]" > comments && venv/bin/python ./llvm/utils/git/code-format-helper.py \ --write-comment-to-file \ From 2f6203c7b393b76f50a8bb418ae8e3553a8b2252 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 28 Sep 2025 14:26:33 +0300 Subject: [PATCH 9/9] better --- .github/workflows/pr-code-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 82e7f6ac3fdff..41212ed37a054 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -56,7 +56,7 @@ jobs: run: | . venv/bin/activate && echo "[]" > comments && - venv/bin/python ./llvm/utils/git/code-format-helper.py \ + python ./llvm/utils/git/code-format-helper.py \ --write-comment-to-file \ --token ${{ secrets.GITHUB_TOKEN }} \ --issue-number $GITHUB_PR_NUMBER \