Przeglądaj źródła

ci: add codeql workflow

Ivan Dyachkov 2 lat temu
rodzic
commit
0c448a7546
1 zmienionych plików z 61 dodań i 0 usunięć
  1. 61 0
      .github/workflows/codeql.yaml

+ 61 - 0
.github/workflows/codeql.yaml

@@ -0,0 +1,61 @@
+name: "CodeQL"
+
+on:
+  schedule:
+    - cron: '33 14 * * 4'
+  workflow_dispatch:
+    inputs:
+      ref:
+        required: false
+
+jobs:
+  analyze:
+    name: Analyze
+    runs-on: ubuntu-latest
+    timeout-minutes: 360
+    permissions:
+      actions: read
+      contents: read
+      security-events: write
+    container:
+      image: ghcr.io/emqx/emqx-builder/5.1-1:1.14.5-25.3.2-1-ubuntu22.04
+
+    strategy:
+      fail-fast: false
+      matrix:
+        language: [ 'cpp', 'python' ]
+
+    steps:
+    - name: Checkout repository
+      uses: actions/checkout@v3
+      with:
+        ref: ${{ github.event.inputs.ref }}
+
+    - name: Ensure git safe dir
+      run: |
+        git config --global --add safe.directory "$GITHUB_WORKSPACE"
+        make ensure-rebar3
+
+    - name: Initialize CodeQL
+      uses: github/codeql-action/init@v2
+      with:
+        languages: ${{ matrix.language }}
+
+    - name: Build
+      if: matrix.language == 'cpp'
+      env:
+        PROFILE: emqx-enterprise
+      run: |
+        make emqx-enterprise-compile
+
+    - name: Fetch deps
+      if: matrix.language == 'python'
+      env:
+        PROFILE: emqx-enterprise
+      run: |
+        make deps-emqx-enterprise
+
+    - name: Perform CodeQL Analysis
+      uses: github/codeql-action/analyze@v2
+      with:
+        category: "/language:${{matrix.language}}"