52 lines
1.9 KiB
YAML
52 lines
1.9 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
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt install -y clang clang-tidy clang-tools ninja-build iwyu
|
|
sudo apt install -y wget libevent-dev libssl-dev libpq-dev libmariadb-dev libsqlite3-dev libhiredis-dev libmongoc-dev libmicrohttpd-dev
|
|
wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libprom-dev-0.1.3-Linux.deb
|
|
wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libpromhttp-dev-0.1.3-Linux.deb
|
|
sudo apt install -y ./libprom-dev-0.1.3-Linux.deb ./libpromhttp-dev-0.1.3-Linux.deb
|
|
|
|
- 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 || exit 0
|