Skip to content

Commit 237487f

Browse files
authored
Merge pull request #146 from akallabeth/master
add option to inject install commands
2 parents 5714de4 + 48a2ce6 commit 237487f

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

Diff for: README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ some system packages (the different `clang-tidy` versions) as well as
6060
some Python packages. This that means that there's a two-three minutes
6161
start-up in order to build the Docker container. If you need to
6262
install some additional packages you can pass them via the
63-
`apt_packages` argument.
63+
`apt_packages` argument or run some install commands with `install_commands`.
6464

6565
Except for very simple projects, a `compile_commands.json` file is necessary for
6666
clang-tidy to find headers, set preprocessor macros, and so on. You can generate
@@ -100,6 +100,8 @@ at once, so `clang-tidy-review` will only attempt to post the first
100100
- default: ''
101101
- `apt_packages`: Comma-separated list of apt packages to install
102102
- default: ''
103+
- `install_commands`: Commands to execute after `apt_packages` before `cmake_command`
104+
- default: ''
103105
- `cmake_command`: A CMake command to configure your project and generate
104106
`compile_commands.json` in `build_dir`. You _almost certainly_ want
105107
to include `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON`!
@@ -149,7 +151,8 @@ jobs:
149151
id: review
150152
with:
151153
# List of packages to install
152-
apt_packages: liblapack-dev
154+
apt_packages: liblapack-dev,devscripts,equivs
155+
install_commands: 'ln -s foo bar; mk-build-deps -i'
153156
# CMake command to run in order to generate compile_commands.json
154157
cmake_command: cmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=on
155158
```

Diff for: action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ inputs:
4141
description: 'Comma-separated list of apt packages to install'
4242
required: false
4343
default: ''
44+
install_commands:
45+
description: 'Commands to execute after `apt_packages` and before `cmake_command`'
46+
required: false
47+
default: ''
4448
cmake_command:
4549
description: 'If set, run CMake as part of the action using this command'
4650
required: false
@@ -87,6 +91,7 @@ runs:
8791
- --include='${{ inputs.include }}'
8892
- --exclude='${{ inputs.exclude }}'
8993
- --apt-packages=${{ inputs.apt_packages }}
94+
- --install-commands='${{ inputs.install_commands }}'
9095
- --cmake-command='${{ inputs.cmake_command }}'
9196
- --max-comments=${{ inputs.max_comments }}
9297
- --lgtm-comment-body='${{ inputs.lgtm_comment_body }}'

Diff for: post/clang_tidy_review/clang_tidy_review/review.py

+12
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ def main():
7777
type=str,
7878
default="",
7979
)
80+
parser.add_argument(
81+
"--install-commands",
82+
help="Comma-separated list of shell commands to execute",
83+
type=str,
84+
default="",
85+
)
8086
parser.add_argument(
8187
"--cmake-command",
8288
help="If set, run CMake as part of the action with this command",
@@ -141,6 +147,12 @@ def main():
141147
check=True,
142148
)
143149

150+
install_commands = strip_enclosing_quotes(args.install_commands)
151+
152+
if install_commands:
153+
with message_group(f"Running additional install commands: {install_commands}"):
154+
subprocess.run(install_commands, shell=True, check=True)
155+
144156
build_compile_commands = f"{args.build_dir}/compile_commands.json"
145157

146158
cmake_command = strip_enclosing_quotes(args.cmake_command)

0 commit comments

Comments
 (0)