name: Coverity Scan develop branch on a weekly basis

on:
  workflow_dispatch:
  schedule:
    - cron: "7 3 * * 0"

jobs:
  coverity:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
      with:
        ref: develop

    - name: Dependencies
      run: |
        sudo apt-get update
        sudo apt-get install -y \
            docbook-xsl \
            google-mock \
            googletest \
            lcov \
            libc-ares-dev \
            libcjson-dev \
            libcjson1 \
            libcunit1-dev \
            libedit-dev \
            libgmock-dev \
            libmicrohttpd-dev \
            libssl-dev \
            libwrap0-dev \
            microsocks \
            python3-all \
            python3-paho-mqtt \
            python3-psutil \
            uthash-dev \
            xsltproc

    - uses: vapier/coverity-scan-action@v1
      with:
        build_language: 'cxx'
        project: "eclipse/mosquitto"
        token: ${{ secrets.COVERITY_SCAN_TOKEN }}
        email: ${{ secrets.COVERITY_SCAN_EMAIL }}
        command: "make binary-all"
