clangd_tidy.yaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. name: 'Clang Tidy (clangd)'
  5. on:
  6. push:
  7. branches: [trunk, action-test]
  8. pull_request:
  9. merge_group:
  10. permissions:
  11. contents: read # For actions/checkout.
  12. pull-requests: read # For dorny/paths-filter to read pull requests.
  13. # Cancel previous workflows on the PR when there are multiple fast commits.
  14. # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
  15. concurrency:
  16. group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  17. cancel-in-progress: true
  18. jobs:
  19. clangd-tidy:
  20. runs-on: ubuntu-22.04
  21. steps:
  22. - name: Harden Runner
  23. uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
  24. with:
  25. egress-policy: block
  26. # When adding endpoints, see README.md.
  27. # prettier-ignore
  28. allowed-endpoints: >
  29. *.blob.storage.azure.net:443
  30. *.githubapp.com:443
  31. *.sourceforge.net:443
  32. api.github.com:443
  33. api.ipify.org:443
  34. bcr.bazel.build:443
  35. downloads.sourceforge.net:443
  36. files.pythonhosted.org:443
  37. github.com:443
  38. go.dev:443
  39. mirror.bazel.build:443
  40. mirrors.kernel.org:443
  41. nodejs.org:443
  42. oauth2.googleapis.com:443
  43. objects.githubusercontent.com:443
  44. pypi.org:443
  45. registry.npmjs.org:443
  46. release-assets.githubusercontent.com:443
  47. releases.bazel.build:443
  48. storage.googleapis.com:443
  49. uploads.github.com:443
  50. www.googleapis.com:443
  51. - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  52. - id: filter
  53. uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  54. with:
  55. filters: |
  56. has_cpp:
  57. - added|modified: '{**/*.cpp,**/*.h}'
  58. list-files: 'shell'
  59. - uses: ./.github/actions/build-setup-common
  60. if: steps.filter.outputs.has_cpp == 'true'
  61. with:
  62. matrix_runner: 'ubuntu-22.04'
  63. remote_cache_upload: '--remote_upload_local_results=false'
  64. - name: Create compile commands
  65. if: steps.filter.outputs.has_cpp == 'true'
  66. run: ./scripts/create_compdb.py
  67. - name: Install clangd-tidy
  68. if: steps.filter.outputs.has_cpp == 'true'
  69. run: pip install clangd-tidy==1.1.0.post2
  70. - name: Run clangd-tidy
  71. if: steps.filter.outputs.has_cpp == 'true'
  72. env:
  73. FILTER_FILES: ${{ steps.filter.outputs.has_cpp_files }}
  74. run: |
  75. clangd-tidy -p . -j 10 $FILTER_FILES