Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

This allows us to not spend 60-90s per job installing all of the tools as they are prebuilt into the container.

This allows us to not spend 60-90s per job installing all of the tools
as they are prebuilt into the container.
@boomanaiden154 boomanaiden154 marked this pull request as ready for review October 12, 2025 06:04
@llvmbot
Copy link
Member

llvmbot commented Oct 12, 2025

@llvm/pr-subscribers-infrastructure
@llvm/pr-subscribers-llvm-ir

@llvm/pr-subscribers-github-workflow

Author: Aiden Grossman (boomanaiden154)

Changes

This allows us to not spend 60-90s per job installing all of the tools as they are prebuilt into the container.


Full diff: https://github.com/llvm/llvm-project/pull/163044.diff

1 Files Affected:

  • (modified) .github/workflows/pr-code-format.yml (+8-18)
diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml
index 1e0dc7045c1cc..106898e502366 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 }}
@@ -23,6 +25,12 @@ jobs:
         with:
           fetch-depth: 2
 
+      # 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 $(pwd)
+
       - name: Get changed files
         id: changed-files
         uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
@@ -39,24 +47,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 }}

@vbvictor
Copy link
Contributor

Did you have a successful test-run?
In #160193, I tried to run with Set Safe Directory but still got error:

Running: darker --check --diff -r HEAD~1...HEAD llvm/utils/git/code-lint-helper.py
ERROR:darker.git:fatal: detected dubious ownership in repository at '/__w/llvm-project/llvm-project'
ERROR:darker.git:To add an exception for this directory, call:
ERROR:darker.git:
ERROR:darker.git:	git config --global --add safe.directory /__w/llvm-project/llvm-project

@boomanaiden154
Copy link
Contributor Author

Did you have a successful test-run?

I thought I tested this one, looks like I just misremembered and only tested my other PR.

@github-actions
Copy link

github-actions bot commented Oct 13, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@llvmbot llvmbot added the infrastructure Bugs about LLVM infrastructure label Oct 13, 2025
@github-actions
Copy link

github-actions bot commented Oct 13, 2025

✅ With the latest revision this PR passed the Python code formatter.

@boomanaiden154
Copy link
Contributor Author

Did you have a successful test-run?

Works now.

Copy link
Contributor

@vbvictor vbvictor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@boomanaiden154 boomanaiden154 merged commit 145f21c into llvm:main Oct 14, 2025
12 checks passed
@boomanaiden154 boomanaiden154 deleted the pr-code-format-container-fast branch October 14, 2025 13:10
akadutta pushed a commit to akadutta/llvm-project that referenced this pull request Oct 14, 2025
This allows us to not spend 60-90s per job installing all of the tools
as they are prebuilt into the container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github:workflow infrastructure Bugs about LLVM infrastructure llvm:ir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants