Skip to content

Commit

Permalink
Add helpers to external
Browse files Browse the repository at this point in the history
  • Loading branch information
pmatos committed Apr 15, 2024
1 parent 65e91d1 commit 37e3f8e
Show file tree
Hide file tree
Showing 3 changed files with 451 additions and 26 deletions.
31 changes: 5 additions & 26 deletions .github/workflows/pr-code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,15 @@ jobs:
separator: ","
skip_initial_fetch: true

# We need to pull the script from the main branch, so that we ensure
# we get the latest version of this script.
- name: Fetch code formatting utils
uses: actions/checkout@v4
with:
repository: 'llvm/llvm-project'
ref: '' # checkout main - or should it be 16 branch cause we use clang-format 16?
sparse-checkout: |
llvm/utils/git/requirements_formatting.txt
llvm/utils/git/code-format-helper.py
sparse-checkout-cone-mode: false
path: code-format-tools

- name: find where code-format-helper.py is
run: |
find code-format-tools -name code-format-helper.py
- name: "Listed files"
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "Formatting files:"
echo "$CHANGED_FILES"
- name: Check clang-format version
run: |
clang-format --version
- name: Check for correct clang-format version
run: clang-format --version | grep -qF '16.0.6'

- name: Setup Python env
uses: actions/setup-python@v4
Expand All @@ -78,17 +60,14 @@ jobs:
START_REV: ${{ github.event.pull_request.base.sha }}
END_REV: ${{ github.event.pull_request.head.sha }}
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
# TODO(boomanaiden154): Once clang v18 is released, we should be able
# TODO(pmatos): Once we adopt v18, we should be able
# to take advantage of the new --diff_from_common_commit option
# explicitly in code-format-helper.py and not have to diff starting at
# the merge base.
# Create an empty comments file so the pr-write job doesn't fail.
# (FEX) Actually v18 has been released but we don't want to fork the
# files from the LLVM repo so we have to wait until code-format-helper.py
# is updated to support the new option.
run: |
echo "[]" > comments &&
python ./code-format-tools/llvm/utils/git/code-format-helper.py \
python ./External/clang-format-helper/code-format-helper.py \
--repo "FEX-emu/FEX" \
--write-comment-to-file \
--issue-number $GITHUB_PR_NUMBER \
--start-rev $(git merge-base $START_REV $END_REV) \
Expand Down
Loading

0 comments on commit 37e3f8e

Please sign in to comment.