|
34 | 34 | jobs:
|
35 | 35 | format-check:
|
36 | 36 | runs-on: ubuntu-latest
|
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + path: |
| 40 | + - check: 'cores/arduino/' |
| 41 | + exclude: 'cores/arduino/api/' |
| 42 | + - check: 'loader/' |
| 43 | + exclude: 'loader/llext_exports\.c$' |
| 44 | + - check: 'libraries/' |
| 45 | + exclude: 'libraries/ea_malloc/' |
37 | 46 | steps:
|
38 | 47 | - name: Checkout code
|
39 | 48 | uses: actions/checkout@v4
|
40 | 49 | with:
|
41 | 50 | submodules: false
|
42 | 51 | persist-credentials: false
|
43 | 52 |
|
44 |
| - - name: Install clang-format |
45 |
| - run: | |
46 |
| - sudo apt-get update |
47 |
| - sudo apt-get install -y clang-format colordiff |
48 |
| -
|
49 |
| - - name: Get changed files |
50 |
| - id: changed-files |
51 |
| - uses: tj-actions/changed-files@v46 |
52 |
| - with: |
53 |
| - files: | |
54 |
| - cores/arduino/**/*.{c,cpp,cc,cxx,h,hpp} |
55 |
| - !cores/arduino/api/** |
56 |
| - loader/**/*.{c,cpp,cc,cxx,h,hpp} |
57 |
| - !loader/llext_exports.c |
58 |
| - libraries/**/*.{c,cpp,cc,cxx,h,hpp} |
59 |
| - !libraries/ea_malloc/** |
60 |
| -
|
61 | 53 | - name: Run clang-format check
|
62 |
| - if: steps.changed-files.outputs.any_changed == 'true' |
63 |
| - run: | |
64 |
| - clang-format --version |
65 |
| - exit_code=0 |
66 |
| -
|
67 |
| - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do |
68 |
| - file_fmt="${file}.tmp" |
69 |
| - clang-format ${file} > ${file_fmt} |
70 |
| - diff -q -u ${file} ${file_fmt} >> /dev/null 2>&1 || { |
71 |
| - echo "❌ Formatting issues found in: $file" |
72 |
| - colordiff -u ${file} ${file_fmt} || true |
73 |
| - exit_code=1 |
74 |
| - } |
75 |
| - done |
76 |
| -
|
77 |
| - exit $exit_code |
| 54 | + |
| 55 | + with: |
| 56 | + clang-format-version: '19' |
| 57 | + check-path: ${{ matrix.path['check'] }} |
| 58 | + exclude-regex: ${{ matrix.path['exclude'] }} |
0 commit comments