name: "CodeQL Scanning"

on:
  push:
    branches: [master, stable]
  pull_request:
    # The branches below must be a subset of the branches above.
    branches: [master]
  schedule:
  - cron: '0 8 * * 6'

jobs:
  analyze-codeql:
    name: Analyze
    runs-on: ubuntu-20.04

    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: Initialize CodeQL
      uses: github/codeql-action/init@v1

    - name: Install Dependencies
      run: |
        sudo apt-get -y -qq update
        sudo apt-get -y -qq --no-install-recommends install \
          cmake \
          extra-cmake-modules \
          libarchive-dev \
          libqt5x11extras5-dev \
          libsqlite3-dev \
          libxcb-keysyms1-dev \
          ninja-build \
          qt5-default \
          qtwebengine5-dev

    - name: Configure & Build
      uses: lukka/run-cmake@v3
      with:
        buildDirectory: ${{ runner.workspace }}/build/

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