HorstBaerbel/action-clang-tidy

Conan compatibility / external build

Closed this issue · 1 comments

Hi!

As your action drops into a docker container and forces compilation inside, pre-install effects do not carry into the build process.

I would like to install Conan packages before, compile myself and only then drop into the Docker container and run clang-tidy.

I think a simple sollution would be to add an additional flag like 'externalbuild' or when the builddir string is empty.

I could add that logic and send a PR over, would you be interested?

This is what I am trying to achieve:

name: Clang-tidy

on:
  push:
    branches: [main, develop]
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]
  workflow_dispatch:

jobs:
  tidy:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository and submodules
      uses: actions/checkout@v2

    - name: Install Conan
      id: conan
      uses: turtlebrowser/get-conan@main

    - name: Compilation
      run: |
        cmake -S . -B cmake-build-relwithdebinfo -DCMAKE_BUILD_TYPE=RelWithDebInfo && make -C cmake-build-relwithdebinfo

    - name: Run clang-tidy
      uses: HorstBaerbel/action-clang-tidy@1.1
      with:
        scandir: '.'
        builddir: 'cmake-build-relwithdebinfo'
        excludedirs: ''
        extensions: 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'
        cmakeoptions: '-DCMAKE_BUILD_TYPE=RelWithDebInfo'

Hi stan!
I haven't touched this in month, but your idea sounds good, so why not. I think a flag "externalbuild" or "useexistingbuild" that defaults to false or "runbuild" which defaults to true is the best option. An empty build dir might or might not be a user error, so don't use that...
Looking forward to your PR