format-check: add collect errors job #47
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Format Check' | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
types: | |
- opened | |
- edited | |
- reopened | |
- synchronize | |
branches: | |
- 'main' | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
jobs: | |
filter-format-check: | |
runs-on: ubuntu-latest | |
outputs: | |
core_any_changed: ${{ steps.changed-files.outputs.core_any_changed }} | |
loader_any_changed: ${{ steps.changed-files.outputs.loader_any_changed }} | |
libraries_any_changed: ${{ steps.changed-files.outputs.libraries_any_changed }} | |
steps: | |
- name: Get changed source files | |
id: changed-files | |
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5 | |
with: | |
files_yaml: | | |
core: | |
- cores/arduino/**/*.{c,cpp,h,hpp} | |
- '!cores/arduino/api/**' | |
loader: | |
- loader/**/*.{c,cpp,h,hpp} | |
- '!loader/llext_exports.c' | |
libraries: | |
- libraries/**/*.{c,cpp,h,hpp} | |
- '!libraries/examples/**' | |
- '!libraries/extras/**' | |
- '!libraries/ea_malloc/**' | |
- name: Output changed files | |
run: | | |
echo "Core changed: ${{ steps.changed-files.outputs.core_any_changed }}" | |
echo "Loader changed: ${{ steps.changed-files.outputs.loader_any_changed }}" | |
echo "Libraries changed: ${{ steps.changed-files.outputs.libraries_any_changed }}" | |
format-check: | |
runs-on: ubuntu-latest | |
needs: | |
- filter-format-check | |
strategy: | |
matrix: | |
path: | |
- name: 'core' | |
check: 'cores/arduino/' | |
exclude: 'cores/arduino/api/' | |
- name: 'loader' | |
check: 'loader/' | |
exclude: 'loader/llext_exports\.c$' | |
- name: 'libraries' | |
check: 'libraries/' | |
exclude: '(examples|extras|ea_malloc)' | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
if: needs.filter-format-check.outputs.${{ matrix.path['name'] }}_any_changed == 'true' | |
uses: actions/checkout@v4 | |
with: | |
submodules: false | |
persist-credentials: false | |
- name: Run clang-format check | |
if: needs.filter-format-check.outputs.${{ matrix.path['name'] }}_any_changed == 'true' | |
uses: jidicula/[email protected] | |
with: | |
clang-format-version: '19' | |
check-path: ${{ matrix.path['check'] }} | |
exclude-regex: ${{ matrix.path['exclude'] }} | |
verify-format: | |
runs-on: ubuntu-latest | |
if: cancelled() || contains(needs.*.result, 'failure') | |
needs: | |
- format-check | |
steps: | |
- name: Notify failure | |
run: exit 1 |