aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/coverity.yml
blob: 2d23c06c287727c51209f60f2c6b8e8617c9ba30 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: coverity
on:
  schedule:
    - cron: '10 0 * * *'  # Run every day at 00:10
  workflow_dispatch:

permissions:
  contents: read

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - name: Check for the Coverity Scan token
        env:
          TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
          EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
        run: |
          if [[ -n "$TOKEN" && -n "EMAIL" ]]; then
            echo "have_coverity_token=yes" >> $GITHUB_ENV
          fi

      - if: env.have_coverity_token
        uses: actions/checkout@v7.0.1
        with:
          persist-credentials: false

      - if: env.have_coverity_token
        uses: ./.github/actions/setup

      - if: env.have_coverity_token
        name: Download Coverity
        run: |
          wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=neovim%2Fneovim" -O coverity_tool.tgz
          mkdir cov-scan
          tar ax -f coverity_tool.tgz --strip-components=1 -C cov-scan
        env:
          TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}

      - if: env.have_coverity_token
        name: Build dependencies
        run: make deps

      - if: env.have_coverity_token
        name: Build/scan neovim
        run: |
          env PATH=$(pwd)/cov-scan/bin:$PATH cov-build --dir cov-int make

      - if: env.have_coverity_token
        name: Submit results
        run: |
          tar zcf cov-scan.tgz cov-int
          curl --form token=$TOKEN \
            --form email=$EMAIL \
            --form file=@cov-scan.tgz \
            --form version="$(git rev-parse HEAD)" \
            --form description="Daily GHA scan" \
            'https://scan.coverity.com/builds?project=neovim%2Fneovim'
        env:
          TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
          EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}