From 110348ec647a9ef5bc43e1b92e1c6906a614f464 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Sat, 11 Oct 2025 22:44:41 -0700 Subject: [PATCH 01/15] [Github] Make pr-code-format.yml use ci-*-format container This allows us to not spend 60-90s per job installing all of the tools as they are prebuilt into the container. --- .github/workflows/pr-code-format.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 1e0dc7045c1cc..ac0689b4d3243 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-format' timeout-minutes: 30 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} @@ -39,24 +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@a276e6e3d1db9160db5edc458e99a30d3b109949 # v1.7.1 - with: - clangformat: 21.1.0 - - - name: Setup Python env - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: '3.13' - 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 - - name: Run code formatter env: GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} From cc6971a50e9afe52a80156820dfcee7418407b83 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Sat, 11 Oct 2025 22:52:22 -0700 Subject: [PATCH 02/15] force error --- .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 ac0689b4d3243..8abbca8d468e5 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -33,6 +33,7 @@ jobs: skip_initial_fetch: true base_sha: 'HEAD~1' sha: 'HEAD' + token: '' - name: "Listed files" env: From 3254be2c1a475c428a1e3d5fd16ba934229ee854 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Sat, 11 Oct 2025 22:54:55 -0700 Subject: [PATCH 03/15] debugging --- .github/workflows/pr-code-format.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 8abbca8d468e5..947c82035fd0f 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -25,6 +25,11 @@ jobs: with: fetch-depth: 2 + - name: debug + run: | + pwd + ls + - name: Get changed files id: changed-files uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5 From d1414bb8f808e1bbb5a9b3e07d0a9330360ab5ab Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Sat, 11 Oct 2025 22:57:10 -0700 Subject: [PATCH 04/15] check --- .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 947c82035fd0f..71dd4aa1ab12e 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -28,7 +28,7 @@ jobs: - name: debug run: | pwd - ls + ls -a - name: Get changed files id: changed-files From e2bc61d419672b927debe3e49635976d2c330df6 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Sat, 11 Oct 2025 23:00:23 -0700 Subject: [PATCH 05/15] testing --- .github/workflows/pr-code-format.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 71dd4aa1ab12e..7b54a42fc17c3 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -27,8 +27,7 @@ jobs: - name: debug run: | - pwd - ls -a + git config --global --add safe.directory /__w/llvm-project/llvm-project - name: Get changed files id: changed-files From 37a3cf143560e2e241be482783d58c1bba1a36ff Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Sat, 11 Oct 2025 23:03:00 -0700 Subject: [PATCH 06/15] fix --- .github/workflows/pr-code-format.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 7b54a42fc17c3..106898e502366 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -25,9 +25,11 @@ jobs: with: fetch-depth: 2 - - name: debug + # We need to set the repo checkout as safe, otherwise tj-actions/changed-files + # will fail due to the changed ownership inside the container. + - name: Set Safe Directory run: | - git config --global --add safe.directory /__w/llvm-project/llvm-project + git config --global --add safe.directory $(pwd) - name: Get changed files id: changed-files @@ -37,7 +39,6 @@ jobs: skip_initial_fetch: true base_sha: 'HEAD~1' sha: 'HEAD' - token: '' - name: "Listed files" env: From 4432b66fada1cda448b8c6ba70bf55cc5de2290f Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 13 Oct 2025 23:02:13 +0000 Subject: [PATCH 07/15] test c++ --- llvm/lib/IR/StructuralHash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/IR/StructuralHash.cpp b/llvm/lib/IR/StructuralHash.cpp index 1c617c100c7dc..1ca4b1404962a 100644 --- a/llvm/lib/IR/StructuralHash.cpp +++ b/llvm/lib/IR/StructuralHash.cpp @@ -18,7 +18,7 @@ using namespace llvm; namespace { -// Basic hashing mechanism to detect structural change to the IR, used to verify +// Basic hashing mechanism to detect structural change to the IR, used to verify. This is a long comment to trip up clang-format. // pass return status consistency with actual change. In addition to being used // by the MergeFunctions pass. From e8a7c7784c2424aac5e61dc62366a825ffe00215 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 13 Oct 2025 23:04:10 +0000 Subject: [PATCH 08/15] Revert "test c++" This reverts commit 4432b66fada1cda448b8c6ba70bf55cc5de2290f. --- llvm/lib/IR/StructuralHash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/IR/StructuralHash.cpp b/llvm/lib/IR/StructuralHash.cpp index 1ca4b1404962a..1c617c100c7dc 100644 --- a/llvm/lib/IR/StructuralHash.cpp +++ b/llvm/lib/IR/StructuralHash.cpp @@ -18,7 +18,7 @@ using namespace llvm; namespace { -// Basic hashing mechanism to detect structural change to the IR, used to verify. This is a long comment to trip up clang-format. +// Basic hashing mechanism to detect structural change to the IR, used to verify // pass return status consistency with actual change. In addition to being used // by the MergeFunctions pass. From 91714523b3769d178cea70e57e12199367e9fd8e Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 13 Oct 2025 23:05:33 +0000 Subject: [PATCH 09/15] test python --- .ci/metrics/metrics_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/metrics/metrics_test.py b/.ci/metrics/metrics_test.py index 3004c367f96ff..29a3e8eac0343 100644 --- a/.ci/metrics/metrics_test.py +++ b/.ci/metrics/metrics_test.py @@ -10,6 +10,7 @@ import metrics +a = ["a really long string", "a really long string", "a really long string", "a really long string", "a really long string", "a really long string"] class TestMetrics(unittest.TestCase): def test_upload_gauge_metric(self): From f5aebca2772ae296bda6d253a41b3f867b0a6c20 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 13 Oct 2025 23:32:04 +0000 Subject: [PATCH 10/15] Try wildcard --- .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 106898e502366..70699fd33c0c0 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -29,7 +29,7 @@ jobs: # will fail due to the changed ownership inside the container. - name: Set Safe Directory run: | - git config --global --add safe.directory $(pwd) + git config --global --add safe.directory '*' - name: Get changed files id: changed-files From 586a80900a0ffd6e1d1362949e48434d3dbaed49 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 13 Oct 2025 23:42:52 +0000 Subject: [PATCH 11/15] ownership --- .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 70699fd33c0c0..921c377d9903e 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -30,6 +30,7 @@ jobs: - name: Set Safe Directory run: | git config --global --add safe.directory '*' + chown -R root $(pwd) - name: Get changed files id: changed-files From e5aa72362a2aaf957924f289c39067b7513d1883 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 13 Oct 2025 23:51:31 +0000 Subject: [PATCH 12/15] todo --- .github/workflows/pr-code-format.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 921c377d9903e..2b85d8b59869c 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -27,9 +27,10 @@ jobs: # We need to set the repo checkout as safe, otherwise tj-actions/changed-files # will fail due to the changed ownership inside the container. + # TODO(boomanaiden154): We should probably fix this by having the default user + # in the container have the same ID as the GHA user on the host. - name: Set Safe Directory run: | - git config --global --add safe.directory '*' chown -R root $(pwd) - name: Get changed files From 227a95c11603191710bf1de8beab4b16b242b7d0 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 13 Oct 2025 23:53:47 +0000 Subject: [PATCH 13/15] test c++ --- .ci/metrics/metrics_test.py | 1 - llvm/lib/IR/StructuralHash.cpp | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/metrics/metrics_test.py b/.ci/metrics/metrics_test.py index 29a3e8eac0343..3004c367f96ff 100644 --- a/.ci/metrics/metrics_test.py +++ b/.ci/metrics/metrics_test.py @@ -10,7 +10,6 @@ import metrics -a = ["a really long string", "a really long string", "a really long string", "a really long string", "a really long string", "a really long string"] class TestMetrics(unittest.TestCase): def test_upload_gauge_metric(self): diff --git a/llvm/lib/IR/StructuralHash.cpp b/llvm/lib/IR/StructuralHash.cpp index 1c617c100c7dc..1863df401a5a9 100644 --- a/llvm/lib/IR/StructuralHash.cpp +++ b/llvm/lib/IR/StructuralHash.cpp @@ -14,6 +14,8 @@ #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Module.h" +// This is a really long comment that clang-format will decide to make multiple lines to trigger a formatting failure. + using namespace llvm; namespace { From 3de8187ebbfae1eab670f1652d8c84e87b2bf983 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 13 Oct 2025 23:55:37 +0000 Subject: [PATCH 14/15] Revert "test c++" This reverts commit 227a95c11603191710bf1de8beab4b16b242b7d0. --- .ci/metrics/metrics_test.py | 1 + llvm/lib/IR/StructuralHash.cpp | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/metrics/metrics_test.py b/.ci/metrics/metrics_test.py index 3004c367f96ff..29a3e8eac0343 100644 --- a/.ci/metrics/metrics_test.py +++ b/.ci/metrics/metrics_test.py @@ -10,6 +10,7 @@ import metrics +a = ["a really long string", "a really long string", "a really long string", "a really long string", "a really long string", "a really long string"] class TestMetrics(unittest.TestCase): def test_upload_gauge_metric(self): diff --git a/llvm/lib/IR/StructuralHash.cpp b/llvm/lib/IR/StructuralHash.cpp index 1863df401a5a9..1c617c100c7dc 100644 --- a/llvm/lib/IR/StructuralHash.cpp +++ b/llvm/lib/IR/StructuralHash.cpp @@ -14,8 +14,6 @@ #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Module.h" -// This is a really long comment that clang-format will decide to make multiple lines to trigger a formatting failure. - using namespace llvm; namespace { From 655bde206121b57a56f98f36c78ab24c9050ed23 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 13 Oct 2025 23:57:51 +0000 Subject: [PATCH 15/15] refix python --- .ci/metrics/metrics_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/metrics/metrics_test.py b/.ci/metrics/metrics_test.py index 29a3e8eac0343..3004c367f96ff 100644 --- a/.ci/metrics/metrics_test.py +++ b/.ci/metrics/metrics_test.py @@ -10,7 +10,6 @@ import metrics -a = ["a really long string", "a really long string", "a really long string", "a really long string", "a really long string", "a really long string"] class TestMetrics(unittest.TestCase): def test_upload_gauge_metric(self):