name: "CodeQL"

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  schedule:
    - cron: '32 0 * * 2'

jobs:
  analyze:
    name: Analyze
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      security-events: write

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

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

      - name: Install dependencies
        run: |
          sudo apt-get -y update
          sudo apt-get -y install tree libconfuse-dev libssl-dev zlib1g-dev php-cgi

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

      - name: Build
        run: |
          ./autogen.sh
          ./configure --enable-builtin-icons --enable-public-html \
                      --enable-htaccess --enable-htpasswd         \
                      --enable-msie-padding
          make

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v4
        with:
          category: "/language:${{ matrix.language }}"
