File: check-code-format.yml

package info (click to toggle)
shotcut 26.1.30%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 60,392 kB
  • sloc: cpp: 77,605; javascript: 11,690; sh: 2,917; xml: 104; python: 84; makefile: 34; ansic: 6
file content (40 lines) | stat: -rw-r--r-- 1,067 bytes parent folder | download | duplicates (2)
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
name: check-code-format

on:
  workflow_dispatch:
  pull_request:
    types: [opened, reopened]
  push:

jobs:
  clang-format:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install clang-format
        run: sudo apt-get install -y clang-format-14

      - name: Check style
        run: |
          FILES=`find . -type f -name "*.h" -o -name "*.c" -o -name "*.cpp"`
          FILTERED_FILES=()
          for file in ${FILES[@]};
          do
            [[ $file =~ "./src/" ]] &&
            [[ ! $file =~ "spatialmedia" ]] &&
            [[ ! $file =~ "defaultlayouts.h" ]] &&
            [[ ! $file =~ "_autogen" ]] &&
            FILTERED_FILES+=($file)
          done
          clang-format-14 --verbose --dry-run --Werror -style=file -i ${FILTERED_FILES[@]}
          if [ $? -eq 0 ]
          then
            echo "SUCCESS: All files are formatted correctly"
            exit 0
          else
          echo "FAILURE: some files are formatted incorrectly"
            exit 99
          fi