name: "CodeQL"

on: [push, pull_request]

jobs:
  analyze:
    name: Analyze
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      security-events: write

    strategy:
      fail-fast: false
      matrix:
        language: [ 'cpp' ]

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

    - name: Dependencies
      run: |
        sudo apt-get update -y
        sudo apt-get install -y apache2-dev libcjose-dev libssl-dev check pkg-config
        sudo apt-get install -y libjansson-dev libcurl4-openssl-dev libhiredis-dev libmemcached-dev libpcre2-dev libpcre2-8-0
        
    - name: CodeQL
      uses: github/codeql-action/init@v3
      with:
        languages: ${{ matrix.language }}

    - name: Configure
      run: |
       ./autogen.sh
       ./configure 
             
    - name: Make
      run: make
 
    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v3