Skip to content

Commit 2470dc1

Browse files
committed
[GitHub][CI] Run clang-format natively in ci-ubuntu container
1 parent 0fc6213 commit 2470dc1

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

.github/workflows/pr-code-format.yml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on:
1212
jobs:
1313
code_formatter:
1414
runs-on: ubuntu-24.04
15+
container:
16+
image: 'ghcr.io/llvm/ci-ubuntu-24.04:latest'
1517
timeout-minutes: 30
1618
concurrency:
1719
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
@@ -38,24 +40,13 @@ jobs:
3840
run: |
3941
echo "Formatting files:"
4042
echo "$CHANGED_FILES"
41-
42-
# The clang format version should always be upgraded to the first version
43-
# of a release cycle (x.1.0) or the last version of a release cycle, or
44-
# if there have been relevant clang-format backports.
45-
- name: Install clang-format
46-
uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1
47-
with:
48-
clangformat: 21.1.0
49-
50-
- name: Setup Python env
51-
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
52-
with:
53-
python-version: '3.11'
54-
cache: 'pip'
55-
cache-dependency-path: 'llvm/utils/git/requirements_formatting.txt'
43+
44+
- name: Create python venv
45+
run: |
46+
python -m venv venv
5647
5748
- name: Install python dependencies
58-
run: pip install -r llvm/utils/git/requirements_formatting.txt
49+
run: venv/bin/pip install -r llvm/utils/git/requirements_formatting.txt
5950

6051
- name: Run code formatter
6152
env:
@@ -64,7 +55,7 @@ jobs:
6455
# Create an empty comments file so the pr-write job doesn't fail.
6556
run: |
6657
echo "[]" > comments &&
67-
python ./llvm/utils/git/code-format-helper.py \
58+
venv/bin/python ./llvm/utils/git/code-format-helper.py \
6859
--write-comment-to-file \
6960
--token ${{ secrets.GITHUB_TOKEN }} \
7061
--issue-number $GITHUB_PR_NUMBER \

0 commit comments

Comments
 (0)