ci: automate pre- and post-release version bump to include -DEV in main #3583 #2725
This file contains hidden or 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: include-what-you-use | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: read | |
jobs: | |
iwyu: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- cmake_options: all-options-abiv1 | |
warning_limit: 0 | |
- cmake_options: all-options-abiv1-preview | |
warning_limit: 0 | |
- cmake_options: all-options-abiv2-preview | |
warning_limit: 0 | |
steps: | |
- name: Harden the runner (Audit all outbound calls) | |
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
submodules: 'recursive' | |
- name: setup dependencies | |
run: | | |
sudo apt update -y | |
sudo apt install -y --no-install-recommends --no-install-suggests \ | |
build-essential \ | |
ninja-build \ | |
libssl-dev \ | |
libcurl4-openssl-dev \ | |
libabsl-dev \ | |
libprotobuf-dev \ | |
libgrpc++-dev \ | |
protobuf-compiler \ | |
protobuf-compiler-grpc \ | |
libgmock-dev \ | |
libgtest-dev \ | |
libbenchmark-dev \ | |
llvm-dev \ | |
libclang-dev \ | |
cmake | |
- name: Install include-what-you-use | |
run: | | |
sudo ./ci/install_iwyu.sh | |
- name: Prepare CMake | |
env: | |
CC: clang | |
CXX: clang++ | |
run: | | |
TOPDIR=`pwd` | |
cmake -B build-${{ matrix.cmake_options }} \ | |
-C ./test_common/cmake/${{ matrix.cmake_options }}.cmake \ | |
-DCMAKE_CXX_STANDARD=14 \ | |
-DWITH_STL=CXX14 \ | |
-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" \ | |
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" | |
- name: iwyu_tool | |
run: | | |
cmake --build build-${{ matrix.cmake_options }} -- -j$(nproc) -k 2>&1 | tee -a iwyu-${{ matrix.cmake_options }}.log | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
if: success() || failure() | |
with: | |
name: Logs-iwyu-${{ matrix.cmake_options }} | |
path: ./iwyu-${{ matrix.cmake_options }}.log | |
- name: count warnings | |
run: | | |
set +e | |
echo "include-what-you-use version:" | |
include-what-you-use --version | |
readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu-${{ matrix.cmake_options }}.log` | |
echo "include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.cmake_options }}'" | |
# Acceptable limit, to decrease over time down to 0 | |
readonly WARNING_LIMIT=${{ matrix.warning_limit }} | |
# FAIL the build if WARNING_COUNT > WARNING_LIMIT | |
if [ $WARNING_COUNT -gt $WARNING_LIMIT ] ; then | |
echo "include-what-you-use reported ${WARNING_COUNT} warning(s) exceeding the existing warning limit of ${WARNING_LIMIT} with cmake options preset '${{ matrix.cmake_options }}'" | |
exit 1 | |
# WARN in annotations if WARNING_COUNT > 0 | |
elif [ $WARNING_COUNT -gt 0 ] ; then | |
echo "::warning::include-what-you-use reported ${WARNING_COUNT} warning(s) with cmake options preset '${{ matrix.cmake_options }}'" | |
fi |