Explicitly use clang-format 19 in CI, reintroduce auto format checks for include/ (#7)

* test clang v19

* require clang-format 19

* Try outputting patch as an artifact

* test CI

* actually set the correct filename

* only upload on failure

* try a more descriptive name

* remove intentional test change

---------

Co-authored-by: someone2639 <someone2639@gmail.com>
This commit is contained in:
someone2639
2025-02-18 22:13:12 -05:00
committed by GitHub
parent 01fa771093
commit 46f03ca93d
3 changed files with 13 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install package requirements
run: sudo apt-get install -y clang-tools clang-format clang-tidy gcc-mips-linux-gnu binutils-mips-linux-gnu build-essential python3
run: sudo apt-get install -y clang-tools-19 clang-format-19 clang-tidy-19 gcc-mips-linux-gnu binutils-mips-linux-gnu build-essential python3
- name: Verify formatting on all files
run: python3 tools/check_format.py --verbose
@@ -33,3 +33,11 @@ jobs:
- name: Build libgultra${{ matrix.suffix }} ${{ matrix.version }}
run: make -j $(nproc) TARGET=libgultra${{ matrix.suffix }} VERSION=${{ matrix.version }}
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
if: failure()
with:
name: 'Changes to Apply'
path: changes.patch
retention-days: 5

View File

@@ -16,7 +16,7 @@ from typing import List
# clang-format, clang-tidy and clang-apply-replacements default version
# This specific version is used when available, for more consistency between contributors
CLANG_VER = 14
CLANG_VER = 19
# Clang-Format options (see .clang-format for rules applied)
FORMAT_OPTS = "-i -style=file"
@@ -122,7 +122,7 @@ def format_files(src_files: List[str], extra_files: List[str], nb_jobs: int):
print("Formatting files with a single job (consider using -j to make this faster)")
# Format files in chunks to improve performance while still utilizing jobs
file_chunks = list(list_chunks(src_files, (len(src_files) // nb_jobs) + 1))
file_chunks = list(list_chunks(src_files + extra_files, (len(src_files + extra_files) // nb_jobs) + 1))
print("Running clang-format...")
# clang-format only applies changes in the given files, so it's safe to run in parallel

View File

@@ -74,7 +74,8 @@ def main():
):
print(l)
print(subprocess.check_output("git diff".split(), text=True))
with open("changes.patch", "w+") as patchf:
patchf.write(subprocess.check_output("git diff".split(), text=True))
exit(1)