static_code_analysis.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. # Copyright (c) 2006-2024, RT-Thread Development Team
  3. #
  4. # SPDX-License-Identifier: Apache-2.0
  5. #
  6. # Change Logs:
  7. # Date Author Notes
  8. # 2024-09-04 Supperthomas add cppcheck use the latest release version
  9. #
  10. name: Static code analysis
  11. on:
  12. workflow_dispatch:
  13. pull_request:
  14. branches:
  15. - master
  16. paths-ignore:
  17. - documentation/**
  18. - '**/README.md'
  19. - '**/README_zh.md'
  20. jobs:
  21. scancode_job:
  22. runs-on: ubuntu-latest
  23. name: Static code analysis
  24. if: github.repository_owner == 'RT-Thread'
  25. steps:
  26. - uses: actions/checkout@v4
  27. - name: Set up Python
  28. uses: actions/setup-python@v3
  29. with:
  30. python-version: 3.8
  31. - name: cppcheck
  32. shell: bash
  33. run: |
  34. sudo apt-get update
  35. pip install click PyYaml
  36. git clone https://github.com/danmar/cppcheck.git
  37. cd cppcheck
  38. git fetch --tags
  39. latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
  40. echo "Latest release tag: $latest_tag"
  41. git checkout $latest_tag
  42. mkdir build
  43. cd build
  44. cmake ..
  45. make
  46. sudo make install FILESDIR=/usr/local/share/Cppcheck CFGDIR=/usr/share/Cppcheck/cfg
  47. cppcheck --version
  48. cd ../../
  49. git remote -v
  50. git fetch origin
  51. ls
  52. git branch -a
  53. python tools/ci/cpp_check.py check