name: "CodeQL"

on:
  push:
    branches:
      - master
    paths-ignore:
      - 'docs/**'
      - 'htdocs/**'
      - 'web-src/**'
  pull_request:
    branches:
      - master
    paths-ignore:
      - 'docs/**'
      - 'htdocs/**'
      - 'web-src/**'
  schedule:
    - cron: '0 19 * * 6'

jobs:
  analyse:
    name: Analyse
    runs-on: ubuntu-latest

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

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

    # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
    # If this step fails, then you should remove it and run the build manually (see below)
    #- name: Autobuild
    #  uses: github/codeql-action/autobuild@v3

    # ℹī¸ Command-line programs to run using the OS shell.
    # 📚 https://git.io/JvXDl

    # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines
    #    and modify them (or add more) to build your code if your project
    #    uses a compiled language
    - run: |
        sudo apt-get update
        sudo apt-get install -yq build-essential clang clang-tools git autotools-dev autoconf libtool gettext gawk gperf bison flex libconfuse-dev libunistring-dev libsqlite3-dev libavcodec-dev libavformat-dev libavfilter-dev libswscale-dev libavutil-dev libasound2-dev libmxml-dev libgcrypt20-dev libavahi-client-dev zlib1g-dev libevent-dev libplist-dev libsodium-dev libcurl4-openssl-dev libjson-c-dev libprotobuf-c-dev libpulse-dev libwebsockets-dev libgnutls28-dev
        autoreconf -vi
        ./configure --enable-lastfm --enable-chromecast
        scan-build --status-bugs -disable-checker deadcode.DeadStores --exclude src/parsers make

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