static-analysis.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: static-analysis
  2. on:
  3. workflow_run:
  4. # Perform static analysis together with build workflow. Build triggers of "build" workflow do not need to be repeated here.
  5. workflows:
  6. - build
  7. types:
  8. - requested
  9. jobs:
  10. PVS-Studio:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v4
  14. with:
  15. fetch-depth: 1
  16. - name: Install Dependencies
  17. env:
  18. # The Secret variable setup in GitHub must be in format: "name_or_email key", on a single line
  19. PVS_STUDIO_LICENSE: ${{ secrets.PVS_STUDIO_LICENSE }}
  20. run: |
  21. if [[ "$PVS_STUDIO_LICENSE" != "" ]];
  22. then
  23. wget -q https://files.viva64.com/etc/pubkey.txt
  24. sudo apt-key add pubkey.txt
  25. sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list
  26. sudo apt-get update
  27. sudo apt-get install -y pvs-studio
  28. pvs-studio-analyzer credentials -o pvs-studio.lic $PVS_STUDIO_LICENSE
  29. fi
  30. - name: PVS-Studio static analysis
  31. run: |
  32. if [[ ! -f pvs-studio.lic ]];
  33. then
  34. echo "PVS Studio license is missing. No analysis will be performed."
  35. echo "If you have a PVS Studio license please create a project secret named PVS_STUDIO_LICENSE with your license."
  36. echo "You may use a free license. More information at https://www.viva64.com/en/b/0457/"
  37. exit 0
  38. fi
  39. cd examples/example_null
  40. pvs-studio-analyzer trace -- make WITH_EXTRA_WARNINGS=1
  41. pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log
  42. plog-converter -a 'GA:1,2;OP:1' -d V1071 -t errorfile -w pvs-studio.log