]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Github action to run clang-tidy on rec PRs
authorFred Morcos <fred.morcos@open-xchange.com>
Mon, 13 Mar 2023 12:53:20 +0000 (13:53 +0100)
committerFred Morcos <fred.morcos@open-xchange.com>
Fri, 21 Apr 2023 11:51:11 +0000 (13:51 +0200)
.github/workflows/clang-tidy.yml
tasks.py

index f4c8c7a13094c33da71b6fce53eca9899761ac8d..88cf73b443f5ad52f3aed4aae56c83a6dc3e06a3 100644 (file)
@@ -9,7 +9,7 @@ permissions:
   contents: read
 
 jobs:
-  clang-tidy:
+  clang-tidy-auth:
     name: auth clang-tidy
     runs-on: ubuntu-20.04
     env:
@@ -56,3 +56,55 @@ jobs:
           if [ -f clang-tidy-results/auth-fixes.yml ]; then
             python .github/scripts/clang-tidy.py --fixes-file clang-tidy-results/auth-fixes.yml
           fi
+
+  clang-tidy-rec:
+    name: rec clang-tidy
+    runs-on: ubuntu-20.04
+    env:
+      UNIT_TESTS: yes
+      SANITIZERS:
+    steps:
+      - uses: PowerDNS/pdns/set-ubuntu-mirror@meta
+      - uses: actions/checkout@v3
+        with:
+          fetch-depth: 2
+      - name: get timestamp for cache
+        id: get-stamp
+        shell: bash
+        run: |
+          echo "stamp=$(/bin/date +%s)" >> "$GITHUB_OUTPUT"
+      - name: let GitHub cache our ccache data
+        uses: actions/cache@v3
+        with:
+          path: ~/.ccache
+          key: recursor-ccache-${{ steps.get-stamp.outputs.stamp }}
+          restore-keys: recursor-ccache-
+      - run: build-scripts/gh-actions-setup-inv  # this runs apt update+upgrade
+      - run: inv apt-fresh
+      - run: inv install-clang
+      - run: inv install-clang-tidy-tools
+      - run: inv install-rec-build-deps
+      - run: inv ci-autoconf
+        working-directory: pdns/recursordist/
+      - run: inv ci-rec-configure
+        working-directory: pdns/recursordist/
+      - run: inv ci-rec-make-bear
+        working-directory: pdns/recursordist/
+      - run: ccache -s
+      - run: mkdir clang-tidy-results
+      - run: ln -s .clang-tidy.full .clang-tidy
+      - name: Run clang-tidy
+        working-directory: pdns/recursordist/
+        run: git diff -U0 HEAD^ | python /usr/bin/clang-tidy-diff-12.py -p3 -export-fixes ../../clang-tidy-results/rec-fixes.yml
+      - name: Print clang-tidy fixes YAML
+        shell: bash
+        run: |
+          if [ -f clang-tidy-results/rec-fixes.yml ]; then
+            cat clang-tidy-results/rec-fixes.yml
+          fi
+      - name: Result annotations
+        shell: bash
+        run: |
+          if [ -f clang-tidy-results/rec-fixes.yml ]; then
+            python .github/scripts/clang-tidy.py --fixes-file clang-tidy-results/rec-fixes.yml
+          fi
index 23dc8be7211b0d50848d701744676092ebbca445..f776ba3d0a0fdaf4fd4d4fe8e5155fd0c30af9af 100644 (file)
--- a/tasks.py
+++ b/tasks.py
@@ -539,6 +539,11 @@ def ci_auth_make_bear(c):
 def ci_rec_make(c):
     c.run('make -j8 -k V=1')
 
+@task
+def ci_rec_make_bear(c):
+    # Assumed to be running under ./pdns/recursordist/
+    c.run('bear --append make -j8 -k V=1')
+
 @task
 def ci_dnsdist_make(c):
     c.run('make -j4 -k V=1')