name: "CodeQL Code Scanning"

on: [push, pull_request, workflow_dispatch]

jobs:
  CodeQL:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          submodules: "true"

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          config-file: ./.github/codeql/codeql-config.yml
          queries: security-and-quality
          languages: cpp, java

      - name: Install Dependencies
        run: sudo apt-get -y update

          sudo apt-get -y install ninja-build extra-cmake-modules scdoc

      - name: Install Qt
        uses: jurplel/install-qt-action@v3
        with:
          aqtversion: "==3.1.*"
          py7zrversion: ">=0.20.2"
          version: "6.8.1"
          host: "linux"
          target: "desktop"
          arch: ""
          modules: "qt5compat qtimageformats qtnetworkauth"
          tools: ""

      - name: Configure and Build
        run: |
          cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr -G Ninja

          cmake --build build

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