1---
2# vi: ts=2 sw=2 et:
3# SPDX-License-Identifier: LGPL-2.1-or-later
4#
5name: Coverity
6
7on:
8  schedule:
9    # Run Coverity daily at midnight
10    - cron:  '0 0 * * *'
11
12permissions:
13  contents: read
14
15jobs:
16  build:
17    runs-on: ubuntu-20.04
18    if: github.repository == 'systemd/systemd'
19    env:
20      COVERITY_SCAN_BRANCH_PATTERN:     "${{ github.ref}}"
21      COVERITY_SCAN_NOTIFICATION_EMAIL: ""
22      COVERITY_SCAN_PROJECT_NAME:       "${{ github.repository }}"
23      # Set in repo settings -> secrets -> repository secrets
24      COVERITY_SCAN_TOKEN:              "${{ secrets.COVERITY_SCAN_TOKEN }}"
25      CURRENT_REF:                      "${{ github.ref }}"
26    steps:
27      - name: Repository checkout
28        uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
29      # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
30      - name: Set the $COVERITY_SCAN_NOTIFICATION_EMAIL env variable
31        run: echo "COVERITY_SCAN_NOTIFICATION_EMAIL=$(git log -1 ${{ github.sha }} --pretty=\"%aE\")" >> "$GITHUB_ENV"
32      - name: Install Coverity tools
33        run: tools/get-coverity.sh
34      # Reuse the setup phase of the unit test script to avoid code duplication
35      - name: Install build dependencies
36        run: sudo -E .github/workflows/unit_tests.sh SETUP
37      # Preconfigure with meson to prevent Coverity from capturing meson metadata
38      - name: Preconfigure the build directory
39        run: meson cov-build -Dman=false
40      - name: Build
41        run: tools/coverity.sh build
42      - name: Upload the results
43        run: tools/coverity.sh upload
44