Skip to content

Commit 09b560f

Browse files
committed
workflows: add Coverity static code analysis
For now, the workflow only lists the issues. Once the Coverity issues are resolved, the output of cov-format-errors can be tested for zero length. Signed-off-by: Peter Colberg <[email protected]>
1 parent 385bd9c commit 09b560f

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/coverity.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Copyright (C) 2021 Intel Corporation
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
4+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
5+
6+
name: Coverity
7+
8+
permissions:
9+
# Grant read permissions to private container images.
10+
packages: read
11+
12+
on:
13+
push:
14+
paths:
15+
- '**'
16+
- '!**.md'
17+
- '!**/.clang-format'
18+
- '!**/COPYING'
19+
- '!**/LICENSE'
20+
- '!.github/**'
21+
- '.github/workflows/coverity.yml'
22+
- '!.gitignore'
23+
- '!cmake/manifests/**'
24+
- '!container/**'
25+
- '!docs/**'
26+
- '!scripts/**'
27+
28+
pull_request:
29+
paths:
30+
- '**'
31+
- '!**.md'
32+
- '!**/.clang-format'
33+
- '!**/COPYING'
34+
- '!**/LICENSE'
35+
- '!.github/**'
36+
- '.github/workflows/coverity.yml'
37+
- '!.gitignore'
38+
- '!cmake/manifests/**'
39+
- '!container/**'
40+
- '!docs/**'
41+
- '!scripts/**'
42+
43+
jobs:
44+
build:
45+
runs-on:
46+
- self-hosted
47+
- linux
48+
- x64
49+
- container
50+
51+
container:
52+
image: ghcr.io/intel/fpga-runtime-for-opencl/ubuntu-22.04-dev:main
53+
volumes:
54+
- /opt/coverity:/opt/coverity
55+
56+
steps:
57+
- uses: actions/checkout@v3
58+
- run: cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release
59+
- run: echo /opt/coverity/latest/bin >> "$GITHUB_PATH"
60+
# The --compiler names must match those used by CMake.
61+
# https://community.synopsys.com/s/article/cov-build-returns-WARNING-No-files-were-emitted-This-may-be-due-to-a-problem-with-your-configuration
62+
# https://community.synopsys.com/s/article/Configuring-Your-Compilers-for-Coverity-Analysis
63+
- run: cov-configure --config config.xml --template --comptype gcc --compiler cc
64+
- run: cov-configure --config config.xml --template --comptype g++ --compiler c++
65+
- run: cov-build --config config.xml --dir results ninja -C build -v -k0
66+
- run: cov-analyze --config config.xml --dir results --concurrency --security --rule --enable-constraint-fpp --enable-fnptr --enable-virtual
67+
- run: cov-format-errors --text-output-style multiline --dir results --filesort --file "$PWD" --strip-path "$PWD" > cov-errors.txt
68+
- run: cat cov-errors.txt
69+
- uses: actions/upload-artifact@v3
70+
with:
71+
name: fpga-runtime-for-opencl-${{ github.sha }}-coverity-${{ github.run_id }}
72+
path: cov-errors.txt
73+
if-no-files-found: error

0 commit comments

Comments
 (0)