clang-tidy-review.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. name: clang-tidy-review
  2. # You can be more specific, but it currently only works on pull requests
  3. on: [pull_request]
  4. jobs:
  5. clang-tidy:
  6. runs-on: ubuntu-22.04
  7. steps:
  8. - uses: actions/checkout@v2
  9. with:
  10. fetch-depth: 2
  11. - name: Install clang-tidy
  12. run: |
  13. sudo apt-get update
  14. sudo apt-get install -y clang-tidy
  15. sudo apt-get install -y ninja-build zlib1g-dev texlive-latex-base qtwebengine5-dev qttools5-dev-tools qttools5-dev qtquickcontrols2-5-dev qt5keychain-dev qtdeclarative5-dev qtbase5-dev python3-sphinx libssl-dev libsqlite3-dev libqt5websockets5-dev libqt5svg5-dev pkg-config libkf5archive-dev libcloudproviders-dev libcmocka-dev libdbus-1-dev qtbase5-private-dev qt5-qmake inkscape
  16. - name: Prepare compile_commands.json
  17. run: |
  18. cmake -G Ninja -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1
  19. cd build && ninja
  20. - name: Create results directory
  21. run: |
  22. mkdir clang-tidy-result
  23. - name: Analyze
  24. run: |
  25. git diff -U0 HEAD^ | clang-tidy-diff -checks='-*,modernize-use-auto,modernize-use-using,modernize-use-nodiscard,modernize-use-nullptr,modernize-use-override,cppcoreguidelines-pro-type-static-cast-downcast' -p1 -path build -export-fixes clang-tidy-result/fixes.yml
  26. - name: Run clang-tidy-pr-comments action
  27. uses: platisd/clang-tidy-pr-comments@master
  28. with:
  29. # The GitHub token (or a personal access token)
  30. github_token: ${{ secrets.GITHUB_TOKEN }}
  31. # The path to the clang-tidy fixes generated previously
  32. clang_tidy_fixes: clang-tidy-result/fixes.yml
  33. # Optionally set to true if you want the Action to request
  34. # changes in case warnings are found
  35. request_changes: true
  36. # Optionally set the number of comments per review
  37. # to avoid GitHub API timeouts for heavily loaded
  38. # pull requests
  39. suggestions_per_comment: 10