ci: add IWYU quirk for chrono #435
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-20.04 | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
# clang-format comes pre-installed | |
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md | |
#- name: Install dependencies | |
# run: | | |
# sudo apt-get remove -y --purge man-db # avoid time-consuming trigger | |
# sudo apt-get update | |
# sudo apt-get install -y clang-format-12 | |
- 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-12 -style=file -i {} \; | |
- name: Check for changes | |
run: git diff --exit-code |