name: Coverity Scan

on:
  schedule:
    - cron: 0 8 * * MON
  workflow_dispatch:

jobs:
  coverity:
    if: github.repository_owner == 'vinylcache'
    runs-on: ubuntu-latest
    steps:
      - run: |
          sudo apt-get update
          sudo apt-get install -y \
            autoconf \
            automake \
            build-essential \
            ca-certificates \
            cpio \
            libedit-dev \
            libjemalloc-dev \
            libncurses-dev \
            libpcre2-dev \
            libtool \
            libunwind-dev \
            pkg-config \
            python3-sphinx
      - uses: actions/checkout@v4
        with:
          submodules: true
      - run: ./autogen.sh
      - run: ./configure --with-persistent-storage
      - uses: vapier/coverity-scan-action@v1.8.0
        with:
          project: vinyl
          email: vinyl-dev@vinyl-cache.org
          token: ${{ secrets.COVERITY_SCAN_TOKEN }}
