forked from ZedThree/clang-tidy-review
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
87 lines (87 loc) · 2.98 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
name: 'clang-tidy review'
author: 'Peter Hill'
description: 'Create a pull request review based on warnings from clang-tidy'
branding:
icon: 'book-open'
color: 'red'
inputs:
token:
description: 'Authentication token'
default: ${{ github.token }}
required: false
build_dir:
description: 'Directory containing the compile_commands.json file'
default: '.'
required: false
base_dir:
description: 'Absolute path to initial working directory. Useful if generating `compile_commands.json` outside of the Action'
default: ${{ github.workspace }}
require: false
clang_tidy_version:
description: 'Version of clang-tidy to use; one of 6.0, 7, 8, 9, 10, 11, 12'
default: '12'
required: false
clang_tidy_checks:
description: 'List of checks'
default: '-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*'
required: false
config_file:
description: 'Location of .clang-tidy config file. If specified, takes preference over `clang_tidy_checks`'
default: ''
required: false
include:
description: 'Comma-separated list of files or patterns to include'
default: "*.[ch],*.[ch]xx,*.[ch]pp,*.[ch]++,*.cc,*.hh"
required: false
exclude:
description: 'Comma-separated list of files or patterns to exclude'
required: false
default: ''
apt_packages:
description: 'Comma-separated list of apt packages to install'
required: false
default: ''
cmake_command:
description: 'If set, run CMake as part of the action using this command'
required: false
default: ''
max_comments:
description: 'Maximum number of comments to post at once'
required: false
default: '25'
pr:
default: ${{ github.event.pull_request.number }}
repo:
default: ${{ github.repository }}
outputs:
total_comments:
description: 'Total number of warnings from clang-tidy'
value: ${{ steps.review.outputs.total_comments }}
runs:
using: 'composite'
steps:
- name: Update APT package indexes
run: "sudo apt-get update -y"
shell: bash
- name: Install APT dependencies
run: "sudo apt-get install -y git python3-pip clang-tidy-${{ inputs.clang_tidy_version }} ${{ inputs.apt_packages }}"
shell: bash
- name: Install PIP dependencies
run: "pip3 install -r $GITHUB_ACTION_PATH/requirements.txt"
shell: bash
- name: Run review
id: review
run: |
python3 $GITHUB_ACTION_PATH/review.py \
--clang_tidy_binary=clang-tidy-${{ inputs.clang_tidy_version }} \
--token=${{ inputs.token }} \
--repo=${{ inputs.repo }} \
--pr=${{ inputs.pr }} \
--build_dir=${{ inputs.build_dir }} \
--base_dir=${{ inputs.base_dir }} \
--clang_tidy_checks=${{ inputs.clang_tidy_checks }} \
--config_file=${{ inputs.config_file }} \
--include='${{ inputs.include }}' \
--exclude='${{ inputs.exclude }}' \
--cmake-command='${{ inputs.cmake_command }}'
shell: bash