ZedThree/clang-tidy-review

Can not find `mpi.h`

Closed this issue · 1 comments

I am trying to run this action on some C++ code which uses MPI.

I am using the build_commands.json generated by CMake as an input to this Action, but I still get an error:

'mpi.h' file not found [clang-diagnostic-error]

Locally, I get this error when the build_commands.json is not given to clang-tidy.
Do you have any idea, why clang-tidy can not find mpi.h in the current setup?

This is what my action looks like:
(the CMAKE_EXPORT_COMPILE_COMMANDS ON is set in the CMakeLists.txt)

jobs:
  compile:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - uses: mpi4py/setup-mpi@v1
        with:
          mpi: 'intelmpi'

      - name: Compile code
        run: |
          cmake .
          make

      - uses: ZedThree/clang-tidy-review@v0.10.0
        id: review
        with:
          config_file: .clang-tidy
          lgtm_comment_body: ""
          split_workflow: true

Hi @christian512, very sorry for it's taken me a long time to reply! This action runs in a separate container to the rest of the workflow, which means it doesn't have access to the same packages. There's an apt_packages argument that you can use to pass in a list of packages to install inside the container. I guess you most likely want:

jobs:
  compile:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - uses: mpi4py/setup-mpi@v1
        with:
          mpi: 'intelmpi'

      - name: Compile code
        run: |
          cmake .
          make

      - uses: ZedThree/clang-tidy-review@v0.10.0
        id: review
        with:
          config_file: .clang-tidy
          lgtm_comment_body: ""
          split_workflow: true
          apt_packages: "python3-mpi4py"

Hope that helps!