clang_tidy.yaml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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'
  5. on:
  6. push:
  7. branches: [trunk, action-test]
  8. pull_request:
  9. permissions:
  10. contents: read # For actions/checkout.
  11. pull-requests: read # For dorny/paths-filter to read pull requests.
  12. # Cancel previous workflows on the PR when there are multiple fast commits.
  13. # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
  14. concurrency:
  15. group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  16. cancel-in-progress: true
  17. jobs:
  18. test:
  19. runs-on: ubuntu-22.04
  20. steps:
  21. - name: Harden Runner
  22. uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
  23. with:
  24. egress-policy: block
  25. # When adding endpoints, see README.md.
  26. # prettier-ignore
  27. allowed-endpoints: >
  28. *.dl.sourceforge.net:443
  29. api.github.com:443
  30. bcr.bazel.build:443
  31. downloads.sourceforge.net:443
  32. github.com:443
  33. mirrors.kernel.org:443
  34. nodejs.org:443
  35. oauth2.googleapis.com:443
  36. objects.githubusercontent.com:443
  37. pypi.org:443
  38. releases.bazel.build:443
  39. sourceforge.net:443
  40. storage.googleapis.com:443
  41. - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
  42. - id: test-setup
  43. uses: ./.github/actions/test-setup
  44. with:
  45. matrix_runner: 'ubuntu-22.04'
  46. base_sha:
  47. ${{ github.event_name == 'pull_request' &&
  48. github.event.pull_request.base.sha ||
  49. github.event.merge_group.base_sha }}
  50. remote_cache_key: ${{ secrets.CARBON_BUILDS_GITHUB }}
  51. targets_file: ${{ runner.temp }}/targets
  52. # Run in the clang-tidy config. This is done as part of tests so that we
  53. # aren't duplicating bazel/llvm setup.
  54. #
  55. # The `-k` flag is used to print all clang-tidy errors.
  56. - name: clang-tidy
  57. if: steps.test-setup.outputs.has_code == 'true'
  58. env:
  59. TARGETS_FILE: ${{ runner.temp }}/targets
  60. run: |
  61. ./scripts/run_bazel.py \
  62. --attempts=5 \
  63. build --config=clang-tidy -k \
  64. --target_pattern_file=$TARGETS_FILE
  65. # See "Disk space before build" in `test-setup`.
  66. - name: Disk space after build
  67. if: steps.test-setup.outputs.has_code == 'true'
  68. run: df -h