codeql.yml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 refname
  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: Restore cached FW
  96. # id: cache-fw-restore
  97. # uses: actions/cache/restore@v3
  98. # with:
  99. # path: |
  100. # ./build
  101. # ./dist
  102. # ./firmware
  103. # key: ${{ runner.os }}-fw
  104. - name: Build Firmware
  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. run: |
  112. ./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=${{ env.FBT_NO_SYNC }}
  113. - name: Build FAPs
  114. shell: bash
  115. if: ${{ success() }}
  116. env:
  117. FBT_NO_SYNC: 0
  118. DIST_SUFFIX: "codeql"
  119. WORKFLOW_BRANCH_OR_TAG: release-cfw
  120. # rm to remove problem FAP which includes non-existent files
  121. run: |
  122. ./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=${{ env.FBT_NO_SYNC }} fap_dist
  123. # - name: Save cached FW
  124. # id: cache-primes-save
  125. # uses: actions/cache/save@v3
  126. # with:
  127. # path: |
  128. # ./build
  129. # ./dist
  130. # ./firmware
  131. # key: ${{ steps.cache-fw-restore.outputs.cache-primary-key }}
  132. # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
  133. # If this step fails, then you should remove it and run the build manually (see below)
  134. #- name: Autobuild
  135. # run: |
  136. # echo "Run, Build Application using script"
  137. # ls -lha
  138. # ./fbt
  139. # uses: github/codeql-action/autobuild@v2
  140. - name: Resolve CodeQL Build Env
  141. uses: github/codeql-action/resolve-environment@v2
  142. with:
  143. language: ${{ matrix.language }}
  144. - name: Perform CodeQL Analysis
  145. uses: github/codeql-action/analyze@v2
  146. env:
  147. REF_NAME: ${{ env.REF_NAME }}
  148. CHECKOUT_PATH: ${{ env.OFW_PATH }}
  149. with:
  150. category: "/language:${{matrix.language}}"
  151. token: ${{ secrets.DEPENDABOT }}
  152. # Must be used only with sha
  153. #ref: ${{ env.REF_NAME }}
  154. #sha: ${{ github.sha }}
  155. output: "a${{ env.CHECKOUT_PATH }}/.github/results.sarif"
  156. check_name: "_"
  157. upload-database: false
  158. upload: "failure-only"
  159. checkout_path: "${{ github.workspace }}/${{ env.CHECKOUT_PATH }}"
  160. - name: Upload CodeQL SARIF
  161. uses: github/codeql-action/upload-sarif@v2
  162. env:
  163. REF_NAME: ${{ env.REF_NAME }}
  164. CHECKOUT_PATH: ${{ env.OFW_PATH }}
  165. with:
  166. category: "/language:${{matrix.language}}"
  167. #token: ${{ secrets.DEPENDABOT }}
  168. # Must be used only with sha
  169. #ref: ${{ env.REF_NAME }}
  170. #sha: ${{ github.sha }}
  171. sarif_file: "a${{ env.CHECKOUT_PATH }}/.github/results.sarif"
  172. checkout_path: "${{ github.workspace }}/${{ env.CHECKOUT_PATH }}"