name: "CodeQL"

on:
  push:
    branches: [ master, develop, g-maintenance ]

jobs:
  analyze:
    name: Analyze
    
    permissions:
      actions: read
      contents: read
      security-events: write

    strategy:
      fail-fast: false
      matrix:
        os: [ 'ubuntu-20.04', 'ubuntu-22.04']
        language: [ 'cpp' ]

    runs-on: ${{ matrix.os }}
    
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Initialize CodeQL
      uses: github/codeql-action/init@v2
      with:
        languages: ${{ matrix.language }}

    - name: Build Hive
      run: |
        git submodule update --init --recursive
        sudo apt install -y doxygen libboost-all-dev libyajl-dev libreadline-dev libssl-dev libtool liblz4-tool ncurses-dev pkg-config python3 python3-dev python3-jinja2 python3-pip libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
        cmake -DCMAKE_BUILD_TYPE=Release .
        make

    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v2
