name: 'Coverity Scan'

on:
  push:
    branches: [coverity_scan]

permissions: {}

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  coverity:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
    - name: Checkout repository
      uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
      with:
        persist-credentials: false
    - name: Install dependencies
      run: |
        sudo apt install qt6-base-dev qt6-svg-dev qt6-base-dev-tools qt6-5compat-dev
    - name: CMake
      run: |
        cmake -S . -B build
        cmake --build build
    - name: Coverity scan
      uses: vapier/coverity-scan-action@2068473c7bdf8c2fb984a6a40ae76ee7facd7a85 # v1.8.0
      with:
        project: 'cutechess/cutechess'
        email: ${{ secrets.COVERITY_SCAN_EMAIL }}
        token: ${{ secrets.COVERITY_SCAN_TOKEN }}
        working-directory: ${{ github.workspace }}/build
