name: "Code Scanning - Action"

on:
  push:
    branches: [2.4, master]
  pull_request:
    # The branches below must be a subset of the branches above
    branches: [2.4, master]
  schedule:
    - cron: '0 7 * * 2'
  workflow_dispatch:

jobs:
  CodeQL-Build:
    runs-on: ubuntu-latest

    permissions:
      # required for all workflows
      security-events: write

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

    # Initializes the CodeQL tools for scanning.
    - name: Initialize CodeQL
      uses: github/codeql-action/init@v2
      # Override language selection by uncommenting this and choosing your languages
      # with:
      #   languages: go, javascript, csharp, python, cpp, java

    - run: |
        sudo apt-get update &&
        sudo apt-get install g++ libtool automake autoconf libsdl2-dev libcurl3-dev \
        libc-ares-dev zlib1g-dev libncurses-dev libglew-dev libglm-dev make &&
        ./autogen.sh &&
        ./configure &&
        make -j`nproc`

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