Parcourir la source

build system: add iwyu workflow (see #777)

Michele Caini il y a 3 ans
Parent
commit
2345002c1c
2 fichiers modifiés avec 61 ajouts et 0 suppressions
  1. 57 0
      .github/workflows/analyzer.yml
  2. 4 0
      entt.imp

+ 57 - 0
.github/workflows/analyzer.yml

@@ -0,0 +1,57 @@
+name: analyzer
+
+on:
+  push:
+    branches:
+      - 'iwyu'
+  schedule:
+    # run at 01:00 every day
+    - cron: '0 1 * * *'
+
+jobs:
+
+  iwyu:
+    timeout-minutes: 30
+
+    env:
+      IWYU: 0.17
+      LLVM: 13
+
+    runs-on: ubuntu-latest
+    continue-on-error: true
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Install llvm/clang
+      # see: https://apt.llvm.org/
+      run: |
+        wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
+        sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-$LLVM main"
+        sudo apt update
+        sudo apt remove -y "llvm*"
+        sudo apt remove -y "libclang-dev*"
+        sudo apt remove -y "clang*"
+        sudo apt install -y llvm-$LLVM-dev
+        sudo apt install -y libclang-$LLVM-dev
+        sudo apt install -y clang-$LLVM
+    - name: Compile iwyu
+      # see: https://github.com/include-what-you-use/include-what-you-use
+      working-directory: build
+      run: |
+        git clone https://github.com/include-what-you-use/include-what-you-use.git --branch $IWYU --depth 1
+        mkdir include-what-you-use/build
+        cd include-what-you-use/build
+        cmake -DCMAKE_C_COMPILER=clang-$LLVM -DCMAKE_CXX_COMPILER=clang++-$LLVM -DCMAKE_INSTALL_PREFIX=./ ..
+        make -j4
+        bin/include-what-you-use --version
+    - name: Compile tests
+      working-directory: build
+      run: |
+        export PATH=$PATH:${GITHUB_WORKSPACE}/build/include-what-you-use/build/bin
+        cmake -DENTT_BUILD_TESTING=ON \
+              -DENTT_BUILD_BENCHMARK=ON \
+              -DENTT_BUILD_EXAMPLE=ON \
+              -DENTT_BUILD_LIB=ON \
+              -DENTT_BUILD_SNAPSHOT=ON \
+              -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-Xiwyu;--mapping_file=${GITHUB_WORKSPACE}/entt.imp;-Xiwyu;--no_fwd_decls;-Xiwyu;--verbose=1" ..
+        make -j4

+ 4 - 0
entt.imp

@@ -0,0 +1,4 @@
+[
+  { "include": [ "@<gtest/internal/.*>", "private", "<gtest/gtest.h>", "public" ] },
+  { "include": [ "@<gtest/gtest-.*>", "private", "<gtest/gtest.h>", "public" ] }
+]