2021-07-24 16:53:02 +03:00
|
|
|
name: 'Lint C/C++ with clang-format'
|
|
|
|
|
2022-08-02 17:05:31 +03:00
|
|
|
on:
|
2021-08-17 17:45:23 +03:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- dev
|
|
|
|
- "release*"
|
|
|
|
tags:
|
2021-08-19 12:56:42 +03:00
|
|
|
- '*'
|
2021-08-17 17:45:23 +03:00
|
|
|
pull_request:
|
2021-07-24 16:53:02 +03:00
|
|
|
|
|
|
|
env:
|
2022-03-23 20:59:20 +03:00
|
|
|
TARGETS: f7
|
2021-07-24 16:53:02 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint_c_cpp:
|
2022-08-02 17:05:31 +03:00
|
|
|
runs-on: [self-hosted,FlipperZeroShell]
|
2021-07-24 16:53:02 +03:00
|
|
|
steps:
|
2021-07-25 14:46:34 +03: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 16:53:02 +03:00
|
|
|
- name: 'Checkout code'
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2021-08-26 20:59:23 +03:00
|
|
|
- name: 'Check code formatting'
|
2021-08-17 18:48:13 +03:00
|
|
|
id: syntax_check
|
2022-08-02 17:05:31 +03:00
|
|
|
run: SET_GH_OUTPUT=1 FBT_TOOLCHAIN_PATH=/opt ./fbt lint
|
2021-08-17 18:48:13 +03:00
|
|
|
|
2021-08-26 20:59:23 +03:00
|
|
|
- name: Report code formatting errors
|
2021-08-17 18:48:13 +03: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 20:59:23 +03:00
|
|
|
Please fix following code formatting errors:
|
2021-08-17 18:48:13 +03:00
|
|
|
```
|
|
|
|
${{ steps.syntax_check.outputs.errors }}
|
|
|
|
```
|
2022-08-02 17:05:31 +03:00
|
|
|
You might want to run `./fbt format` for an auto-fix.
|