Use the include-what-you-use program to (partially) clean up header includes, so that only includes which are needed, and no includes that are not needed (or at least closer to that ideal) are done. For a c-language project, the build-time improvements from this change is minimal. This would have a much bigger impact on a C++ project than a C-project for build times. So for coturn, this change is mostly intended to just provide consistency and make it easier to locate weird issues like strange dependencies, and unnecessary connections between code.
48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
name: clang-tidy
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
types: [ opened, reopened, synchronize ]
|
|
|
|
jobs:
|
|
clang-tidy:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
config: [Release]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: install dependencies
|
|
uses: ./.github/workflows/actions/ubuntu-build-deps
|
|
with:
|
|
SUDO: true
|
|
|
|
- name: Configure
|
|
run: |
|
|
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_EXPORT_COMPILE_COMMANDS=true
|
|
|
|
- name: Compile
|
|
run: |
|
|
cmake --build build --parallel --config ${{ matrix.config }}
|
|
|
|
# Implicitly requires build/compile_commands.json to exist
|
|
- name: Run Clang Tidy
|
|
run: |
|
|
wget https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-14.0.6/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
|
|
chmod +x run-clang-tidy.py
|
|
./run-clang-tidy.py -j $(nproc) -p build
|
|
|
|
# Implicitly requires build/compile_commands.json to exist
|
|
- name: Run IWYU
|
|
run: |
|
|
wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/clang_14/iwyu_tool.py
|
|
chmod +x iwyu_tool.py
|
|
# iwyu_tool.py returns non-zero if any executions returned nonzero. Which... happens to be useless unless the project is already IWYU clean.
|
|
./iwyu_tool.py -j $(nproc) -p build -- -Xiwyu --mapping_file=${GITHUB_WORKSPACE}/iwyu-ubuntu.imp | grep -v "has correct" | uniq || exit 0
|