Skip to content

Commit a13a448

Browse files
mirenradia2bndy5
andauthored
Run LLVM install script on Linux runners (#146)
* Run LLVM install script on Linux runners This will add the relevant LLVM PPA to the runner's package manager which provides versions of clang-format and clang-tidy that may not yet be available in the official Ubuntu repositories (e.g. LLVM 16 on Ubuntu 22.04 at the time this commit was authored). * Only use LLVM script after failure from Ubuntu repos This also separates the steps of installing the dependencies on Linux runners from the dependencies on other runners. * Remove unnecessary apt-get update * Combine dependency installation into 1 step * Update action.yml * nest the call to instal script in a conditional statement --------- Co-authored-by: Brendan <[email protected]>
1 parent 77982d5 commit a13a448

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

action.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,23 @@ runs:
9090
run: |
9191
if [[ "${{runner.os}}" == "Linux" ]]; then
9292
sudo apt-get update
93-
sudo apt-get install clang-format-${{ inputs.version }} clang-tidy-${{ inputs.version }} || true
93+
# First try installing from default Ubuntu repositories before trying LLVM script
94+
if ! sudo apt-get install clang-format-${{ inputs.version }} clang-tidy-${{ inputs.version }}; then
95+
# This LLVM script will add the relevant LLVM PPA: https://apt.llvm.org/
96+
wget https://apt.llvm.org/llvm.sh -O $GITHUB_ACTION_PATH/llvm_install.sh
97+
chmod +x $GITHUB_ACTION_PATH/llvm_install.sh
98+
if sudo $GITHUB_ACTION_PATH/llvm_install.sh ${{ inputs.version }}; then
99+
sudo apt-get install clang-format-${{ inputs.version }} clang-tidy-${{ inputs.version }}
100+
fi
101+
fi
94102
fi
95-
if [[ "${{runner.os}}" == "macOS" ]];then
103+
if [[ "${{runner.os}}" == "macOS" ]]; then
96104
python3 -m venv '${{ github.action_path }}/venv'
97105
source '${{ github.action_path }}/venv/bin/activate'
98106
fi
99107
python3 -m pip install -r '${{ github.action_path }}/requirements.txt'
100108
clang-tools -i ${{ inputs.version }} -b
109+
101110
- name: Run cpp-linter
102111
id: cpp-linter
103112
shell: bash

0 commit comments

Comments
 (0)