
name: CPP-coverity
# It runs static analysis build - Coverity. It requires special token (set in CI's secret).

on:
  schedule:
    # run this job at 00:00 UTC everyday
    - cron:  '0 0 * * *'

env:
  REPO:           libpmemobj-cpp
  GITHUB_REPO:    pmem/libpmemobj-cpp
  CONTAINER_REG:  ghcr.io/pmem/libpmemobj-cpp
  HOST_WORKDIR:   ${{ github.workspace }}
  WORKDIR:        utils/docker
  IMG_VER:        latest
  COVERITY_SCAN_NOTIFICATION_EMAIL:  ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}
  COVERITY_SCAN_TOKEN:               ${{ secrets.COVERITY_SCAN_TOKEN }}

jobs:
  linux:
    name: Linux-coverity
    runs-on: ubuntu-latest
    strategy:
      matrix:
        CONFIG: ["TYPE=coverity OS=ubuntu OS_VER=20.04"]
    steps:
      - name: Clone the git repo
        uses: actions/checkout@v2

      # coverity workflow should just reuse (pull) the most recent, available image
      - name: Pull the image
        run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh pull

      - name: Run the build
        run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh
