forked from MinyazevR/clazy-standalone-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
142 lines (132 loc) · 4.53 KB
/
action.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: 'Clazy action'
description: 'GitHub Action for use clazy in Qt Projects'
inputs:
version:
description: 'Clazy version'
required: true
default: '1.11'
path-regex:
description: |
Regular expression matching the names of the source files to output diagnostics from.
required: false
default: ''
checks:
description: |
Comma-separated list of clazy checks. Default is level1.
required: false
default: "level1"
warnings_as_errors:
description: |
comma-separated list of checks that will be promoted to errors.
required: false
default: ""
extra-arg:
description: |
Additional argument to append to the compiler command line.
required: false
default: ""
extra-arg-before:
description: |
Additional argument to prepend to the compiler command line.
required: false
default: ""
install-stable:
description: |
The stable version is being downloaded without compilation.
In this case, the version field is ignored.
required: false
default: false
header-filter:
description: |
Regular expression matching the names of the headers to output diagnostics from.
Diagnostics from the main file of each translation unit are always displayed.
required: false
default: ''
only-qt:
description: |
Won't emit warnings for non-Qt files, or in other words, if -DQT_CORE_LIB is missing.
required: false
default: false
qt4-compat:
description: |
Turns off checks not compatible with Qt 4
required: false
default: false
visit-implicit-code:
description: |
For visiting implicit code like compiler generated constructors. None of the built-in checks benefit from this, but can be useful for custom checks
required: false
default: false
database:
description: |-
Is used to read a compile command database.
default: ""
outputs:
warnings-count:
description: 'Total warnings count'
errors-count:
description: 'Total warnings count'
runs:
using: 'composite'
steps:
- name: Cache files
uses: actions/cache@v4
id: cache-clazy
with:
path: ~/.local/clazy/
key: ${{ runner.os }}-clazy-${{ inputs.version }}-${{ github.event.pull_request.number }}
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends clang-tidy expect
- name: Install build dependencies
shell: bash
if: ${{ inputs.install-stable != 'true' }}
run: |
sudo apt-get install -y --no-install-recommends libclang-dev llvm-dev
- name: Install clazy
if: ${{ inputs.install-stable }} == 'true'
shell: bash
run: |
sudo apt-get update
sudo apt-get install clazy
- name: Build clazy
shell: bash
if: ${{ steps.cache-clazy.outputs.cache-hit != 'true' && inputs.install-stable != 'true' }}
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
ninja-build \
cmake
wget -O ./clazy.tar.gz https://github.com/KDE/clazy/archive/refs/tags/v${{ inputs.version }}.tar.gz
tar -xzvf clazy.tar.gz && rm -rf clazy.tar.gz
cd ./clazy-${{ inputs.version }} && cmake -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=~/.local/clazy/lib -DCMAKE_INSTALL_PREFIX=~/.local/clazy -DCMAKE_BUILD_TYPE=Release -G Ninja \
&& cmake --build . \
&& cmake --build . --target install && cd .. && rm -rf ./clazy-${{ inputs.version }}
- name: Save clazy
if: ${{ steps.cache-clazy.outputs.cache-hit != 'true' && inputs.install-stable != 'true' }}
uses: actions/cache@v4
with:
path: ~/.local/clazy
key: ${{ runner.os }}-clazy-${{ inputs.version }}-${{ github.event.pull_request.number }}
- name: Start clazy
id: clazy-check
shell: bash
env:
CHECKS: ${{ inputs.checks }}
EXTRA_ARG: ${{ inputs.extra-arg }}
EXTRA_ARG_BEFORE: ${{ inputs.extra-arg-before }}
DATABASE: ${{ inputs.database }}
HEADER_FILTER: ${{ inputs.header-filter }}
PATH_REGEX: ${{ inputs.path-regex }}
ONLY_QT: ${{ inputs.only-qt }}
QT4_COMPAT: ${{ inputs.qt4-compat }}
VISIT_IMPLICIT_CODE: ${{ inputs.visit-implicit-code }}
WARNINGS_AS_ERRORS: ${{ inputs.warnings_as_errors }}
run: |
PATH=~/.local/clazy/bin:$PATH "$GITHUB_ACTION_PATH/clazy.sh"
- name: Exit if error
if: ${{steps.clazy-check.outputs.errors-count > 0 }}
shell: bash
run: exit 1