From 51c4318a517b13e3f86104f8fafe8265d7bbb0fc Mon Sep 17 00:00:00 2001 From: Nickolay Olshevsky Date: Sat, 19 Oct 2024 15:57:16 +0300 Subject: [PATCH 1/4] CI: Add IWYU (include what you use) action. --- .github/workflows/lint.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5fce5a8d6..68c950d69 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -84,3 +84,39 @@ jobs: set -eux pwd [[ "$(cat ./rnp/version.txt)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; + iwyu: + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + submodules: true + - name: Install dependencies + run: | + sudo apt-get -y update + sudo apt-get -y install cmake libjson-c-dev libbotan-2-dev asciidoctor googletest + + - name: Configure + env: + CC: clang + CXX: clang++ + run: | + echo CORES="$(nproc --all)" >> $GITHUB_ENV + cmake -B build -DBUILD_SHARED_LIBS=ON \ + -DCRYPTO_BACKEND=botan \ + -DDOWNLOAD_GTEST=OFF \ + -DGTEST_SOURCES=/usr/src/googletest \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DCMAKE_BUILD_TYPE=Release . + + - name: Build and cwd + run: | + cmake --build build --parallel $CORES + cd build + + - name: Run Include What You Use + uses: EmilGedda/include-what-you-use-action@v1.0 + with: + compilation-database-path: 'build' + From a3329259e5b731f23c97a51c1c5a2074e0b9363b Mon Sep 17 00:00:00 2001 From: Nickolay Olshevsky Date: Sat, 19 Oct 2024 16:36:04 +0300 Subject: [PATCH 2/4] Fix --- .github/workflows/lint.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 68c950d69..55a6436a7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -113,9 +113,15 @@ jobs: - name: Build and cwd run: | cmake --build build --parallel $CORES - cd build + ls -la /usr/include || true + ls -la /usr/include/botan || true + ls -la /usr/include/x86_64-linux-gnu/ || true + ls -la /usr/include/x86_64-linux-gnu/botan || true - name: Run Include What You Use + env: + CPLUS_INCLUDE_PATH: /usr/include/x86_64-linux-gnu + C_INCLUDE_PATH: /usr/include/x86_64-linux-gnu uses: EmilGedda/include-what-you-use-action@v1.0 with: compilation-database-path: 'build' From 41edeab4621c6ef95ac1a2d91c74a13bd10ec391 Mon Sep 17 00:00:00 2001 From: Nickolay Olshevsky Date: Sat, 19 Oct 2024 16:43:14 +0300 Subject: [PATCH 3/4] Fix 2 --- .github/workflows/lint.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 55a6436a7..cb521f239 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -113,15 +113,13 @@ jobs: - name: Build and cwd run: | cmake --build build --parallel $CORES - ls -la /usr/include || true - ls -la /usr/include/botan || true - ls -la /usr/include/x86_64-linux-gnu/ || true - ls -la /usr/include/x86_64-linux-gnu/botan || true + ls -la /usr/src/googletest || true + ls -la /usr/src/googletest/include || true - name: Run Include What You Use env: - CPLUS_INCLUDE_PATH: /usr/include/x86_64-linux-gnu - C_INCLUDE_PATH: /usr/include/x86_64-linux-gnu + CPLUS_INCLUDE_PATH: /usr/include/botan-2;/usr/include/json-c;/usr/src/googletest/include + C_INCLUDE_PATH: /usr/include/botan-2;/usr/include/json-c;/usr/src/googletest/include uses: EmilGedda/include-what-you-use-action@v1.0 with: compilation-database-path: 'build' From 5b0389a09a04bed44d3a585c2d96d6dd85f7c695 Mon Sep 17 00:00:00 2001 From: Nickolay Olshevsky Date: Sun, 29 Dec 2024 13:12:14 +0200 Subject: [PATCH 4/4] Fix 3 --- .github/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cb521f239..6230ffb17 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -108,6 +108,7 @@ jobs: -DDOWNLOAD_GTEST=OFF \ -DGTEST_SOURCES=/usr/src/googletest \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ -DCMAKE_BUILD_TYPE=Release . - name: Build and cwd