static_code_analysis.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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-22.04
  23. name: Static code analysis
  24. if: github.repository_owner == 'RT-Thread'
  25. steps:
  26. - uses: actions/checkout@main
  27. - name: Set up Python
  28. uses: actions/setup-python@main
  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 remote -v
  37. git fetch origin
  38. ls
  39. git branch -a
  40. git clone https://github.com/danmar/cppcheck.git
  41. cd cppcheck
  42. git fetch --tags
  43. latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
  44. echo "Latest release tag: $latest_tag"
  45. git checkout $latest_tag
  46. make FILESDIR=/usr/local/share/Cppcheck -j2
  47. sudo make install FILESDIR=/usr/local/share/Cppcheck
  48. cppcheck --version
  49. cd ..
  50. python tools/ci/cpp_check.py check