2021-07-24 16:53:02 +03:00
|
|
|
name: 'Lint C/C++ with clang-format'
|
|
|
|
|
2021-08-17 17:45:23 +03:00
|
|
|
on:
|
|
|
|
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-05-16 22:01:57 +03:00
|
|
|
runs-on: [self-hosted,FlipperZero]
|
2021-07-24 16:53:02 +03:00
|
|
|
steps:
|
|
|
|
- name: 'Cleanup workspace'
|
|
|
|
uses: AutoModality/action-clean@v1
|
|
|
|
|
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-07-25 14:46:34 +03:00
|
|
|
submodules: true
|
2021-07-24 16:53:02 +03:00
|
|
|
|
|
|
|
- name: 'Docker cache'
|
|
|
|
uses: satackey/action-docker-layer-caching@v0.0.11
|
|
|
|
continue-on-error: true
|
|
|
|
with:
|
|
|
|
key: docker-cache-${{ hashFiles('docker/**') }}-{hash}
|
|
|
|
restore-keys: docker-cache-${{ hashFiles('docker/**') }}-
|
|
|
|
|
|
|
|
- name: 'Build docker image'
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
|
2021-08-26 20:59:23 +03:00
|
|
|
- name: 'Check code formatting'
|
2021-08-17 18:48:13 +03:00
|
|
|
id: syntax_check
|
2021-07-24 16:53:02 +03:00
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2022-06-26 15:00:03 +03:00
|
|
|
run: SET_GH_OUTPUT=1 ./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-01-05 19:10:18 +03:00
|
|
|
You might want to run `docker compose exec dev make format` for an auto-fix.
|