|
22 | 22 | default: 'warning' |
23 | 23 |
|
24 | 24 | jobs: |
25 | | - filter-format-check: |
| 25 | + filter-format: |
26 | 26 | runs-on: ubuntu-latest |
27 | 27 | outputs: |
28 | | - core_any_changed: ${{ steps.changed-files.outputs.core_any_changed }} |
29 | | - loader_any_changed: ${{ steps.changed-files.outputs.loader_any_changed }} |
30 | | - libraries_any_changed: ${{ steps.changed-files.outputs.libraries_any_changed }} |
31 | | - any_changed: ${{ steps.changed-files.outputs.core_any_changed == 'true' || |
32 | | - steps.changed-files.outputs.loader_any_changed == 'true' || |
33 | | - steps.changed-files.outputs.libraries_any_changed == 'true' }} |
| 28 | + any_changed: ${{ steps.changed-files.outputs.any_changed }} |
34 | 29 | steps: |
35 | | - - name: Get changed source files |
| 30 | + - name: Get changed source files that need format check |
36 | 31 | id: changed-files |
37 | 32 | uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5 |
38 | 33 | with: |
39 | | - files_yaml: | |
40 | | - core: |
41 | | - - cores/arduino/**/*.{c,cpp,h,hpp} |
42 | | - - '!cores/arduino/api/**' |
43 | | - loader: |
44 | | - - loader/**/*.{c,cpp,h,hpp} |
45 | | - - '!loader/llext_exports.c' |
46 | | - libraries: |
47 | | - - libraries/**/*.{c,cpp,h,hpp} |
48 | | - - '!libraries/examples/**' |
49 | | - - '!libraries/extras/**' |
50 | | - - '!libraries/ea_malloc/**' |
| 34 | + files: | |
| 35 | + cores/arduino/**/*.{c,cpp,h,hpp,ino} |
| 36 | + loader/**/*.{c,cpp,h,hpp,ino} |
| 37 | + libraries/**/*.{c,cpp,h,hpp,ino} |
| 38 | + files_ignore: | |
| 39 | + cores/arduino/api/** |
| 40 | + loader/llext_exports.c |
| 41 | + libraries/examples/** |
| 42 | + libraries/extras/** |
| 43 | + libraries/ea_malloc/** |
| 44 | + write_output_files: true |
| 45 | + - name: List of changed files |
| 46 | + if: steps.changed-files.outputs.any_changed == 'true' |
| 47 | + run: cat .github/outputs/changed_files.txt |
51 | 48 |
|
52 | | - format-check: |
| 49 | + verify-format: |
53 | 50 | runs-on: ubuntu-latest |
54 | 51 | needs: |
55 | | - - filter-format-check |
56 | | - if: needs.filter-format-check.outputs.any_changed |
57 | | - strategy: |
58 | | - matrix: |
59 | | - path: |
60 | | - - name: 'core' |
61 | | - check: 'cores/arduino/' |
62 | | - exclude: 'cores/arduino/api/' |
63 | | - - name: 'loader' |
64 | | - check: 'loader/' |
65 | | - exclude: 'loader/llext_exports\.c$' |
66 | | - - name: 'libraries' |
67 | | - check: 'libraries/' |
68 | | - exclude: '(examples|extras|ea_malloc)' |
69 | | - fail-fast: false |
70 | | - |
| 52 | + - filter-format |
| 53 | + if: needs.filter-format.outputs.any_changed |
71 | 54 | steps: |
72 | 55 | - name: Checkout code |
73 | | - if: needs.filter-format-check.outputs[format('{0}_any_changed', matrix.path['name'])] == 'true' |
74 | 56 | uses: actions/checkout@v4 |
75 | 57 | with: |
76 | 58 | submodules: false |
77 | 59 | persist-credentials: false |
78 | 60 |
|
79 | 61 | - name: Run clang-format check |
80 | | - if: needs.filter-format-check.outputs[format('{0}_any_changed', matrix.path['name'])] == 'true' |
81 | | - |
| 62 | + uses: pillo79/clang-format-action@main |
82 | 63 | with: |
83 | 64 | clang-format-version: '19' |
84 | | - check-path: ${{ matrix.path['check'] }} |
85 | | - exclude-regex: ${{ matrix.path['exclude'] }} |
86 | | - |
87 | | - verify-format: |
88 | | - runs-on: ubuntu-latest |
89 | | - if: cancelled() || contains(needs.*.result, 'failure') |
90 | | - needs: |
91 | | - - format-check |
92 | | - steps: |
93 | | - - name: Notify failure |
94 | | - run: exit 1 |
| 65 | + check-files-from: .github/outputs/changed_files.txt |
0 commit comments