-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run LLVM install script on Linux runners #146
Conversation
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fed your changes into the test repo, and it looks like the added PPA doesn't support v9-v12 on Ubuntu 22.04 (jammy). See this workflow run. So, we might be only able to use this approach for select versions of LLVM (v13-v16 as of this writing). In the future, we might have to keep updating the action.yml when the github runner's ubuntu image is updated.
Maybe we just need to use if [[ "${{ inputs.version }}" == "16" ]]; then
# This LLVM script will add the relevant LLVM PPA: https://apt.llvm.org/
wget https://apt.llvm.org/llvm.sh -O $GITHUB_ACTION_PATH/llvm_install.sh
chmod +x $GITHUB_ACTION_PATH/llvm_install.sh
sudo $GITHUB_ACTION_PATH/llvm_install.sh ${{ inputs.version }} || true
fi |
That could also work. |
Ah, I had hoped the
It would be good if there was a way to avoid hardcoding the number 16 so that this change would be robust to upgrades LLVM versions (and runner Ubuntu version). Maybe it should try installing the package from the Ubuntu package repos first and only try this LLVM install script if the former fails? |
I like this idea better because it seems more future-proof. 👍🏼 |
This also separates the steps of installing the dependencies on Linux runners from the dependencies on other runners.
OK, I've tried to implement what I suggested above. There's probably a syntax error somewhere as I haven't got a good way to test GitHub actions locally so please let me know if there are problems when the relevant workflows have run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works!
Now, I hate to ask for more changes because your time is very appreciated. I think we can reduce the steps back into 1:
if [[ "${{runner.os}}" == "Linux" ]]; then
sudo apt-get update
if ! sudo apt-get install clang-format-${{ inputs.version }} clang-tidy-${{ inputs.version }}
then
# This LLVM script will add the relevant LLVM PPA: https://apt.llvm.org/
wget https://apt.llvm.org/llvm.sh -O $GITHUB_ACTION_PATH/llvm_install.sh
chmod +x $GITHUB_ACTION_PATH/llvm_install.sh
sudo $GITHUB_ACTION_PATH/llvm_install.sh ${{ inputs.version }} all
fi
# ... if not on linux runner
where the added all
arg is subject to my review observation.
I'm happy to change it back to 1 step if that's what you want. One argument you might want to consider keeping them as separate steps is that it makes the log output easier to parse. Let me know what you prefer. |
Since we switched to a composite action (no more docker), the logs have been a little weird... Each composite step gets its own collapsible "group" of log statements. But our cpp-linter package creates a subset of grouped logs which will never render as intended until
Either way, I see the human readability of the deps-setup step as an issue with github actions (not entirely within our control). @shenxianpeng are you ok with the dependency-install steps separated? I don't really have preference either way. I only suggested combining the install steps because that's how it was before. |
I prefer to combine the install dependencies steps into one step as before if possible. it seems more simple and readable. thank you for your time on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! I'll leave this open to give @shenxianpeng a chance to review it as well, but this LGTM.
The test-run #6 is passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. thank you!
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).
This resolves #145.