codeql.yml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. name: "CodeQL"
  2. on:
  3. schedule:
  4. - cron: "30 0 * * *"
  5. # Allows you to run this workflow manually from the Actions tab
  6. workflow_dispatch:
  7. jobs:
  8. # is required nightly build?
  9. # More info at https://stackoverflow.com/questions/63014786/how-to-schedule-a-github-actions-nightly-build-but-run-it-only-when-there-where
  10. check:
  11. runs-on: ubuntu-latest
  12. permissions:
  13. contents: read
  14. steps:
  15. - uses: octokit/[email protected]
  16. id: check_last_run
  17. with:
  18. route: GET /repos/{owner}/{repo}/actions/workflows/codeql.yml/runs?per_page=1&status=success
  19. owner: ${{ github.repository_owner }}
  20. repo: kamailio
  21. env:
  22. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  23. - run: |
  24. echo Last daily build: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}
  25. echo commit_message: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_commit.message }}
  26. echo display_title: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].display_title }}
  27. echo conclusion: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].conclusion }}
  28. outputs:
  29. last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}
  30. analyze:
  31. needs: [check]
  32. if: needs.check.outputs.last_sha != github.sha
  33. name: Analyze
  34. runs-on: [self-hosted, linux, x64, codeql]
  35. permissions:
  36. actions: read
  37. contents: read
  38. security-events: write
  39. strategy:
  40. fail-fast: false
  41. matrix:
  42. language: [ javascript, cpp, python ]
  43. container:
  44. image: ghcr.io/kamailio/pkg-kamailio-docker:${{ github.ref_name }}-bookworm
  45. credentials:
  46. username: ${{ github.actor }}
  47. password: ${{ secrets.GITHUB_TOKEN }}
  48. volumes:
  49. - ${{ github.workspace }}:/code
  50. steps:
  51. - name: Checkout
  52. uses: actions/checkout@v4
  53. with:
  54. submodules: recursive
  55. - name: Configure (cpp)
  56. if: ${{ matrix.language == 'cpp' }}
  57. run: make include_modules='app_lua app_python3 cnxcc db_mysql db_postgres db_redis dialplan http_client jansson lcr ndb_redis presence presence_xml presence_dialoginfo pua pua_dialoginfo topos_redis uuid websocket xmlops' cfg
  58. - name: After Prepare (cpp)
  59. if: ${{ matrix.language == 'cpp' }}
  60. run: export PKG_CONFIG_PATH=$RUNNER_TEMP/usr/lib/pkgconfig:$PKG_CONFIG_PATH && echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
  61. - name: Initialize CodeQL
  62. uses: github/codeql-action/init@v3
  63. with:
  64. languages: ${{ matrix.language }}
  65. queries: +security-and-quality
  66. - name: Autobuild
  67. uses: github/codeql-action/autobuild@v3
  68. if: ${{ matrix.language == 'javascript' || matrix.language == 'python' }}
  69. - name: Build cpp
  70. if: ${{ matrix.language == 'cpp' }}
  71. run: make all
  72. - name: Perform CodeQL Analysis
  73. uses: github/codeql-action/analyze@v3
  74. with:
  75. category: "/language:${{ matrix.language }}"