aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/coverity.yml21
-rw-r--r--Makefile8
2 files changed, 29 insertions, 0 deletions
diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml
new file mode 100644
index 0000000..ab33388
--- /dev/null
+++ b/.github/workflows/coverity.yml
@@ -0,0 +1,21 @@
+name: coverity
+on:
+ push:
+ branches:
+ - master
+
+jobs:
+ coverity:
+ timeout-minutes: 5
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: run-scan
+ run: |
+ sudo apt-get update
+ sudo apt-get -y install libjson-c-dev libcmocka-dev clang valgrind \
+ python3-pytest debianutils
+ make coverity VERBOSE=1
+ env:
+ COVERITY_TOKEN: ${{ secrets.COVERITY_TOKEN }}
+ COVERITY_EMAIL: ${{ secrets.COVERITY_EMAIL }}
diff --git a/Makefile b/Makefile
index a33dbb8..11900cb 100644
--- a/Makefile
+++ b/Makefile
@@ -52,6 +52,7 @@ ifeq ($(VERBOSE),)
MAKEFLAGS += -s
endif
+GIT_SHA = $(shell git rev-parse --short HEAD)
CMAKE = $(shell bash -c "command -v cmake3 cmake" | head -1)
RSTLINT= $(shell bash -c "command -v restructuredtext-lint /bin/true" | head -1)
@@ -135,6 +136,13 @@ pre-push: realclean
make pytest-valgrind
make install DESTDIR=tmp.install
+coverity: realclean
+ curl -sS -L -o coverity.tar.gz -d "token=$$COVERITY_TOKEN&project=nutanix%2Flibvfio-user" https://scan.coverity.com/download/cxx/linux64
+ tar xf coverity.tar.gz
+ ./cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j4 all
+ tar czf coverity-results.tar.gz cov-int
+ curl --form token=$$COVERITY_TOKEN --form email=$$COVERITY_EMAIL --form file=@coverity-results.tar.gz --form version="$(GIT_SHA)" https://scan.coverity.com/builds?project=nutanix%2Flibvfio-user
+
GCOVS=$(patsubst %.c,%.c.gcov, $(wildcard lib/*.c))
gcov: realclean test $(GCOVS)