51 lines
1.9 KiB
YAML
51 lines
1.9 KiB
YAML
name: Linting
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
iwyu:
|
|
name: Include What You Use
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: debian:sid-slim
|
|
steps:
|
|
- name: Install dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends ca-certificates clang-14 cmake git iwyu libbenchmark-dev libcurl4-openssl-dev ninja-build zlib1g-dev
|
|
|
|
- name: Checkout source
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: true
|
|
|
|
- name: "CMake Configure"
|
|
run: cmake -GNinja -DRUN_IWYU=ON -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 -S ${GITHUB_WORKSPACE} -B ${GITHUB_WORKSPACE}/_build
|
|
|
|
- name: Build
|
|
run: cmake --build ${GITHUB_WORKSPACE}/_build 2>&1 | tee ${GITHUB_WORKSPACE}/output.txt
|
|
|
|
- name: Check build output
|
|
run: if egrep -q 'should (add|remove) these lines' ${GITHUB_WORKSPACE}/output.txt; then exit 1; fi
|
|
|
|
#- name: "CMake Configure"
|
|
# run: cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -S ${GITHUB_WORKSPACE} -B ${GITHUB_WORKSPACE}/_build
|
|
|
|
#- name: "Run IWYU"
|
|
# run: iwyu_tool -p ${GITHUB_WORKSPACE}/_build core push pull -- -Xiwyu --mapping_file=${GITHUB_WORKSPACE}/cmake/googletest.imp -Xiwyu --no_fwd_decls 2>&1 | tee ${{ github.workspace }}/output.txt
|
|
|
|
format:
|
|
name: Clang Format
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@v3
|
|
|
|
# clang-format comes pre-installed
|
|
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
|
|
|
|
- name: Run clang-format
|
|
run: find . -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.cxx' -o -name '*.o' -o -name '*.h' -o -name '*.hpp' -o -name '*.hxx' \) -exec clang-format-15 -style=file -i {} \;
|
|
|
|
- name: Check for changes
|
|
run: git diff --exit-code
|