iwyu.yml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. name: include-what-you-use
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. branches: [ main ]
  7. permissions:
  8. contents: read
  9. jobs:
  10. iwyu:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Harden the runner (Audit all outbound calls)
  14. uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
  15. with:
  16. egress-policy: audit
  17. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
  18. with:
  19. submodules: 'recursive'
  20. - name: setup dependencies
  21. run: |
  22. sudo apt update -y
  23. sudo apt install -y --no-install-recommends --no-install-suggests \
  24. build-essential \
  25. iwyu \
  26. ninja-build \
  27. libssl-dev \
  28. libcurl4-openssl-dev \
  29. libprotobuf-dev \
  30. protobuf-compiler \
  31. libgmock-dev \
  32. libgtest-dev \
  33. libbenchmark-dev
  34. sudo ./ci/setup_cmake.sh
  35. - name: setup grpc
  36. run: |
  37. sudo ./ci/setup_grpc.sh
  38. - name: Prepare CMake
  39. run: |
  40. TOPDIR=`pwd`
  41. mkdir build && cd build
  42. CC="clang" CXX="clang++" cmake \
  43. -DCMAKE_CXX_STANDARD=14 \
  44. -DWITH_STL=CXX14 \
  45. -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" \
  46. -DBUILD_TESTING=ON \
  47. -DBUILD_W3CTRACECONTEXT_TEST=ON \
  48. -DWITH_OTLP_GRPC=ON \
  49. -DWITH_OTLP_HTTP=ON \
  50. -DWITH_OTLP_FILE=ON \
  51. -DWITH_OPENTRACING=ON \
  52. -DWITH_OTLP_HTTP_COMPRESSION=ON \
  53. -DWITH_THREAD_INSTRUMENTATION=ON \
  54. -DWITH_ZIPKIN=ON \
  55. -DWITH_PROMETHEUS=ON \
  56. ..
  57. - name: iwyu_tool
  58. run: |
  59. cd build
  60. make -k 2>&1 | tee -a iwyu.log
  61. - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  62. if: success() || failure()
  63. with:
  64. name: Logs (include-what-you-use)
  65. path: ./build/*.log
  66. - name: count warnings
  67. run: |
  68. set +e
  69. cd build
  70. readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu.log`
  71. echo "include-what-you-use reported ${WARNING_COUNT} warning(s)"
  72. # Acceptable limit, to decrease over time down to 0
  73. readonly WARNING_LIMIT=0
  74. # FAIL the build if WARNING_COUNT > WARNING_LIMIT
  75. if [ $WARNING_COUNT -gt $WARNING_LIMIT ] ; then
  76. exit 1
  77. # WARN in annotations if WARNING_COUNT > 0
  78. elif [ $WARNING_COUNT -gt 0 ] ; then
  79. echo "::warning::include-what-you-use reported ${WARNING_COUNT} warning(s)"
  80. fi