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:
|
2021-09-10 05:19:02 +03:00
|
|
|
TARGETS: f6 f7
|
2021-07-24 16:53:02 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint_c_cpp:
|
2021-12-24 22:35:25 +03:00
|
|
|
runs-on: [self-hosted,Office]
|
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:
|
2021-08-17 18:48:13 +03:00
|
|
|
run: SET_GH_OUTPUT=1 /syntax_check.sh
|
|
|
|
|
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 }}
|
|
|
|
```
|
|
|
|
You might want to run `docker compose exec dev /syntax_check.sh` for an auto-fix.
|