2021-07-24 13:53:02 +00:00
|
|
|
name: 'Lint C/C++ with clang-format'
|
|
|
|
|
2022-08-02 14:05:31 +00:00
|
|
|
on:
|
2021-08-17 14:45:23 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- dev
|
|
|
|
- "release*"
|
|
|
|
tags:
|
2021-08-19 09:56:42 +00:00
|
|
|
- '*'
|
2021-08-17 14:45:23 +00:00
|
|
|
pull_request:
|
2021-07-24 13:53:02 +00:00
|
|
|
|
|
|
|
env:
|
2022-03-23 17:59:20 +00:00
|
|
|
TARGETS: f7
|
2021-07-24 13:53:02 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint_c_cpp:
|
2022-08-02 14:05:31 +00:00
|
|
|
runs-on: [self-hosted,FlipperZeroShell]
|
2021-07-24 13:53:02 +00:00
|
|
|
steps:
|
2021-07-25 11:46:34 +00:00
|
|
|
- name: 'Decontaminate previous build leftovers'
|
|
|
|
run: |
|
|
|
|
if [ -d .git ]
|
|
|
|
then
|
|
|
|
git submodule status \
|
|
|
|
|| git checkout `git rev-list --max-parents=0 HEAD | tail -n 1`
|
|
|
|
fi
|
|
|
|
|
2021-07-24 13:53:02 +00:00
|
|
|
- name: 'Checkout code'
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2021-08-26 17:59:23 +00:00
|
|
|
- name: 'Check code formatting'
|
2021-08-17 15:48:13 +00:00
|
|
|
id: syntax_check
|
2022-08-02 14:05:31 +00:00
|
|
|
run: SET_GH_OUTPUT=1 FBT_TOOLCHAIN_PATH=/opt ./fbt lint
|
2021-08-17 15:48:13 +00:00
|
|
|
|
2021-08-26 17:59:23 +00:00
|
|
|
- name: Report code formatting errors
|
2021-08-17 15:48:13 +00:00
|
|
|
if: failure() && steps.syntax_check.outputs.errors && github.event.pull_request
|
|
|
|
uses: peter-evans/create-or-update-comment@v1
|
|
|
|
with:
|
|
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
|
|
body: |
|
2021-08-26 17:59:23 +00:00
|
|
|
Please fix following code formatting errors:
|
2021-08-17 15:48:13 +00:00
|
|
|
```
|
|
|
|
${{ steps.syntax_check.outputs.errors }}
|
|
|
|
```
|
2022-08-02 14:05:31 +00:00
|
|
|
You might want to run `./fbt format` for an auto-fix.
|