name: "CodeQL"

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  schedule:
    - cron: '22 2 * * 1'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  analyze:
    name: Analyze
    runs-on: ubuntu-24.04

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

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

    - if: matrix.language == 'cpp'
      name: Install Deps
      run: |
         sudo apt-get update && \
         sudo apt-get install -y \
            libpugixml-dev libexiv2-dev libsqlite3-dev \
            libduktape207 duktape-dev \
            lsb-release uuid-dev\
            libmagic-dev libmatroska-dev libexif-dev

         sudo bash ./scripts/install-pupnp.sh
         sudo bash ./scripts/install-fmt.sh
         sudo bash ./scripts/install-spdlog.sh
         sudo bash ./scripts/install-taglib.sh

    # Initializes the CodeQL tools for scanning.
    - name: Initialize CodeQL
      uses: github/codeql-action/init@v3
      with:
        languages: ${{ matrix.language }}
        config-file: ./.github/codeql/codeql-config.yml

    - name: Autobuild
      uses: github/codeql-action/autobuild@v3

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