Welcome to mirror list, hosted at ThFree Co, Russian Federation.

lint_c.yml « workflows « .github - github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f834586d37565f1f650412ec40eecd1242dde23d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: 'Lint C/C++ with clang-format'

on: 
  push:
    branches:
      - dev
      - "release*"
    tags:
      - '*'
  pull_request:

env:
  TARGETS: f7

jobs:
  lint_c_cpp:
    runs-on: [self-hosted,FlipperZero]
    steps:
      - name: 'Cleanup workspace'
        uses: AutoModality/action-clean@v1

      - 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

      - name: 'Checkout code'
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          submodules: true

      - 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

      - name: 'Check code formatting'
        id: syntax_check
        uses: ./.github/actions/docker
        with:
          run: SET_GH_OUTPUT=1 ./fbt lint

      - name: Report code formatting errors
        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: |
            Please fix following code formatting errors:
            ```
            ${{ steps.syntax_check.outputs.errors }}
            ```
            You might want to run `docker compose exec dev make format` for an auto-fix.