codacy.yml 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # This workflow uses actions that are not certified by GitHub.
  2. # They are provided by a third-party and are governed by
  3. # separate terms of service, privacy policy, and support
  4. # documentation.
  5. # This workflow checks out code, performs a Codacy security scan
  6. # and integrates the results with the
  7. # GitHub Advanced Security code scanning feature. For more information on
  8. # the Codacy security scan action usage and parameters, see
  9. # https://github.com/codacy/codacy-analysis-cli-action.
  10. # For more information on Codacy Analysis CLI in general, see
  11. # https://github.com/codacy/codacy-analysis-cli.
  12. name: Codacy Security Scan
  13. on:
  14. push:
  15. branches: [ "master" ]
  16. pull_request:
  17. # The branches below must be a subset of the branches above
  18. branches: [ "master" ]
  19. permissions:
  20. contents: read
  21. jobs:
  22. codacy-security-scan:
  23. permissions:
  24. contents: read # for actions/checkout to fetch code
  25. security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
  26. actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
  27. name: Codacy Security Scan
  28. runs-on: ubuntu-latest
  29. steps:
  30. # Checkout the repository to the GitHub Actions runner
  31. - name: Checkout code
  32. uses: actions/checkout@v3
  33. # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
  34. - name: Run Codacy Analysis CLI
  35. uses: codacy/codacy-analysis-cli-action@master
  36. with:
  37. # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
  38. # You can also omit the token and run the tools that support default configurations
  39. project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
  40. verbose: true
  41. output: results.sarif
  42. format: sarif
  43. # Adjust severity of non-security issues
  44. gh-code-scanning-compat: true
  45. # Force 0 exit code to allow SARIF file generation
  46. # This will handover control about PR rejection to the GitHub side
  47. max-allowed-issues: 2147483647
  48. # Upload the SARIF file generated in the previous step
  49. - name: Upload SARIF results file
  50. uses: github/codeql-action/upload-sarif@v2
  51. with:
  52. sarif_file: results.sarif
  53. codacy-coverage-reporter:
  54. runs-on: ubuntu-latest
  55. name: codacy-coverage-reporter
  56. steps:
  57. - uses: actions/checkout@v3
  58. - name: Install gtest
  59. run: |
  60. mkdir build && cd build
  61. git clone -b release-1.11.0 --depth=1 https://github.com/google/googletest.git googletest
  62. cd googletest && mkdir gtest_build && cd gtest_build
  63. sudo cmake .. && sudo make
  64. sudo make install
  65. - name: Install LCOV
  66. run: |
  67. sudo apt-get install lcov
  68. - name: Compile
  69. if: ${{ success() }}
  70. shell: bash
  71. run: |
  72. gcc --version
  73. cd build
  74. cmake -DASAN=ON -DCOVERAGE=ON -DSTRICT_ERROR=ON ..
  75. make
  76. - name: Run Testcase
  77. run: |
  78. build/bin/Cbox-test
  79. lcov --directory build --capture --output-file build/test.info
  80. - name: Run codacy-coverage-reporter
  81. uses: codacy/codacy-coverage-reporter-action@v1
  82. with:
  83. project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
  84. coverage-reports: 'build/test.info'
  85. # or a comma-separated list for multiple reports
  86. # coverage-reports: <PATH_TO_REPORT>, <PATH_TO_REPORT>