summaryrefslogtreecommitdiffstats
path: root/.github/workflows/codeql.yml
blob: d57e17aa7d50e74b991a4ece080496c9873a31df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# CodeQL build configuration for nvme-cli
# Mostly based on auto-configuration with additions and tweaks for:
# * meson install
# * language detection
name: "CodeQL"

on:
  push:
    branches: [ "master" ]
  pull_request:
    # The branches below must be a subset of the branches above
    branches: [ "master" ]
  schedule:
    - cron: '24 2 * * 5'

jobs:
  analyze:
    name: Analyze
    # Runner size impacts CodeQL analysis time. To learn more, please see:
    #   - https://gh.io/recommended-hardware-resources-for-running-codeql
    #   - https://gh.io/supported-runners-and-hardware-resources
    #   - https://gh.io/using-larger-runners
    # Consider using larger runners for possible analysis time improvements.
    runs-on: 'ubuntu-latest'
    timeout-minutes: 360
    permissions:
      actions: read
      contents: read
      security-events: write

    strategy:
      fail-fast: false
      matrix:
        language: [ 'c-cpp', 'python' ]
        # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
        # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
        # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
        # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Install build tools
      run: |
          sudo apt-get update
          sudo apt-get install meson

    # Initializes the CodeQL tools for scanning.
    - if: matrix.language == 'c-cpp'
      name: Initialize CodeQL C
      uses: github/codeql-action/init@v3
      with:
        languages: 'c-cpp'

    - if: matrix.language == 'python'
      name: Initialize CodeQL Python
      uses: github/codeql-action/init@v3
      with:
        languages: 'python'
        config-file: ./.github/codeql/codeql-config.yml
  
    - name: meson build
      run: |
         meson setup --force-fallback-for=libnvme,json-c .build
         ninja -C .build

    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v3
      with:
        category: "/language:${{matrix.language}}"