codeql.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. # For most projects, this workflow file will not need changing; you simply need
  2. # to commit it to your repository.
  3. #
  4. # You may wish to alter this file to override the set of languages analyzed,
  5. # or to provide custom queries or build logic.
  6. #
  7. # ******** NOTE ********
  8. # We have attempted to detect the languages in your repository. Please check
  9. # the `language` matrix defined below to confirm you have the correct set of
  10. # supported CodeQL languages.
  11. #
  12. name: "CodeQL"
  13. on:
  14. push:
  15. branches: [ "master", "feat/ci" ]
  16. pull_request:
  17. # The branches below must be a subset of the branches above
  18. branches: [ "master" ]
  19. schedule:
  20. - cron: '43 14 * * *'
  21. workflow_dispatch:
  22. jobs:
  23. analyze:
  24. name: Analyze
  25. # Runner size impacts CodeQL analysis time. To learn more, please see:
  26. # - https://gh.io/recommended-hardware-resources-for-running-codeql
  27. # - https://gh.io/supported-runners-and-hardware-resources
  28. # - https://gh.io/using-larger-runners
  29. # Consider using larger runners for possible analysis time improvements.
  30. runs-on: 'ubuntu-latest'
  31. timeout-minutes: 360
  32. permissions:
  33. actions: read
  34. contents: read
  35. security-events: write
  36. strategy:
  37. fail-fast: false
  38. matrix:
  39. language: [ 'cpp' ]
  40. # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
  41. # Use only 'java' to analyze code written in Java, Kotlin or both
  42. # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
  43. # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
  44. env:
  45. REPO_SELF: ${{ vars.REPO_SELF }}
  46. OFW_PATH: "applications_user/subbrute"
  47. RELATIVE_PATH: "applications/external/subbrute"
  48. CURRENT_VERSION: ${{ vars.RELEASE_VERSION }}
  49. RELEASE_VERSION: ${{ vars.RELEASE_VERSION }}
  50. TOKEN: ${{ secrets.DEPENDABOT }}
  51. REF_NAME: ${{ github.ref_name }}
  52. steps:
  53. - name: Checkout Firmware Files
  54. uses: actions/checkout@v3
  55. with:
  56. repository: "${{ vars.REPO_UNLEASHED }}"
  57. clean: "true"
  58. submodules: "true"
  59. ref: "dev"
  60. fetch-depth: '0'
  61. - name: Checkout Repo Files
  62. uses: actions/checkout@v3
  63. with:
  64. repository: "${{ vars.REPO_SELF }}"
  65. clean: "true"
  66. submodules: "true"
  67. path: "${{ env.OFW_PATH }}"
  68. fetch-depth: '0'
  69. - name: Remove other apps
  70. shell: pwsh
  71. if: ${{ success() }}
  72. # rm to remove problem FAP which includes non-existent files
  73. run: |
  74. Remove-Item -Force -Recurse ./applications/debug -ErrorAction SilentlyContinue
  75. Remove-Item -Force -Recurse ./applications/examples -ErrorAction SilentlyContinue
  76. - name: Set version
  77. env:
  78. REF_NAME: ${{ env.REF_NAME }}
  79. shell: pwsh
  80. run: |
  81. $ReleaseVersion = ([string]::IsNullOrWhitespace($env:REF_NAME) ? 'dev' : $env:REF_NAME)
  82. Write-Output ('REF_NAME={0}' -f $ReleaseVersion) >> $env:GITHUB_ENV
  83. # Initializes the CodeQL tools for scanning.
  84. - name: Initialize CodeQL
  85. uses: github/codeql-action/init@v2
  86. with:
  87. languages: ${{ matrix.language }}
  88. setup-python-dependencies: true
  89. debug: true
  90. # If you wish to specify custom queries, you can do so here or in a config file.
  91. # By default, queries listed here will override any specified in a config file.
  92. # Prefix the list here with "+" to use these queries and those in the config file.
  93. # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
  94. # queries: security-extended,security-and-quality
  95. - name: Build Firmware
  96. shell: bash
  97. if: ${{ success() }}
  98. env:
  99. FBT_NO_SYNC: 0
  100. DIST_SUFFIX: 'codeql'
  101. WORKFLOW_BRANCH_OR_TAG: release-cfw
  102. run: |
  103. ./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=0
  104. - name: Build FAPs
  105. shell: bash
  106. if: ${{ success() }}
  107. env:
  108. FBT_NO_SYNC: 0
  109. DIST_SUFFIX: 'codeql'
  110. WORKFLOW_BRANCH_OR_TAG: release-cfw
  111. # rm to remove problem FAP which includes non-existent files
  112. run: |
  113. ./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=0 fap_dist
  114. # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
  115. # If this step fails, then you should remove it and run the build manually (see below)
  116. #- name: Autobuild
  117. # run: |
  118. # echo "Run, Build Application using script"
  119. # ls -lha
  120. # ./fbt
  121. # uses: github/codeql-action/autobuild@v2
  122. - name: Resolve CodeQL Build Env
  123. uses: github/codeql-action/resolve-environment@v2
  124. with:
  125. language: ${{ matrix.language }}
  126. - name: Perform CodeQL Analysis
  127. uses: github/codeql-action/analyze@v2
  128. env:
  129. REF_NAME: ${{ env.REF_NAME }}
  130. with:
  131. category: "/language:${{matrix.language}}"
  132. token: ${{ secrets.DEPENDABOT }}
  133. ref: ${{ env.REF_NAME }}
  134. output: "../results"
  135. check_name: "_"
  136. upload-database: true
  137. upload: 'failure-only'
  138. checkout_path: ${{ github.workspace }}
  139. - name: List output
  140. env:
  141. REF_NAME: ${{ env.REF_NAME }}
  142. shell: pwsh
  143. run: |
  144. ls "../results"
  145. - name: Upload CodeQL SARIF
  146. uses: github/codeql-action/upload-sarif@v2
  147. env:
  148. REF_NAME: ${{ env.REF_NAME }}
  149. with:
  150. category: "/language:${{matrix.language}}"
  151. token: ${{ secrets.DEPENDABOT }}
  152. ref: ${{ env.REF_NAME }}
  153. sarif_file: "../results"
  154. checkout_path: ${{ github.workspace }}