Skip to content
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

Merged
merged 6 commits into from
May 19, 2023

Conversation

mirenradia
Copy link
Contributor

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.

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).
Copy link
Collaborator

@2bndy5 2bndy5 left a 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.

@shenxianpeng
Copy link
Collaborator

Maybe we just need to use llvm_install.sh for installing version 16 enough.

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

@2bndy5
Copy link
Collaborator

2bndy5 commented May 16, 2023

That could also work.

@mirenradia
Copy link
Contributor Author

mirenradia commented May 16, 2023

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.

Ah, I had hoped the || true would save me from this problem but it doesn't seem to have done so.

Maybe we just need to use llvm_install.sh for installing version 16 enough.

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?

@2bndy5
Copy link
Collaborator

2bndy5 commented May 16, 2023

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.
@mirenradia
Copy link
Contributor Author

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.

@mirenradia mirenradia requested a review from 2bndy5 May 16, 2023 15:06
2bndy5
2bndy5 previously requested changes May 16, 2023
Copy link
Collaborator

@2bndy5 2bndy5 left a 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.

action.yml Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
@mirenradia
Copy link
Contributor Author

Now, I hate to ask for more changes because your time is very appreciated. I think we can reduce the steps back into 1:

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.

@2bndy5
Copy link
Collaborator

2bndy5 commented May 17, 2023

One argument you might want to consider keeping them as separate steps is that it makes the log output easier to parse.

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

  • github supports nested log groups
  • github provides an option to control the log groups for a composite action

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.

@shenxianpeng
Copy link
Collaborator

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.

@mirenradia mirenradia requested a review from 2bndy5 May 18, 2023 09:54
action.yml Outdated Show resolved Hide resolved
@2bndy5 2bndy5 dismissed their stale review May 18, 2023 10:03

outdated

action.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@2bndy5 2bndy5 left a 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.

Copy link
Collaborator

@shenxianpeng shenxianpeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thank you!

@shenxianpeng shenxianpeng merged commit a13a448 into cpp-linter:main May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for clang-tools v16
3 participants