add coverity script
authorMichael Wallner <mike@php.net>
Wed, 14 Sep 2016 12:36:48 +0000 (14:36 +0200)
committerMichael Wallner <mike@php.net>
Wed, 14 Sep 2016 12:36:48 +0000 (14:36 +0200)
.coverity.asc [new file with mode: 0644]
README.md
scripts/coverity.sh [new file with mode: 0755]

diff --git a/.coverity.asc b/.coverity.asc
new file mode 100644 (file)
index 0000000..79f4068
--- /dev/null
@@ -0,0 +1,12 @@
+-----BEGIN PGP MESSAGE-----
+
+hQEMAwqQFiRaTnxoAQgArhSb2v6XxX0h5AiNbj72BTfoiXmviWQ9B6zDtQocaivU
+3JEEeUeqOTA1bflW4pCmWnbn4aehDj2uSYgFy2vf4Xu4RCzdu07dC2t9maeP20f2
+jOsi6MzKjGTvlnLu+5mNLcM8o4nhSiV4HIiwgQK7Cd79RhQuO5CSuV6tuY199kqV
+FzPwFetEhcHmhhlFeXqIjLFAfdttPoEjqS+iyVZw1K4L7D/GWRsVUvKD+FNeZh3I
+MtY9Q2j/X4ZAoAG37APGLnaWF92u6enp9v2WPqsCkMAVMr6ZRjSwLmDhnyrpuNMH
+jMwk/2nRMuQXrzmh5vIs8NlvajSJlRryDnDTDNoXJtJSAag3HzgnObqUb2H6klQC
+kZ+nXBDQlNvuLf2wyBtJy6f8X8XhLGnb67fV2BHg1t9lG8wvRol1qB0cgH9YAneS
+nanGvymsS0OKotCKCtLIoYUCTg==
+=Ww65
+-----END PGP MESSAGE-----
index 96a7b313b070ab1b4f76602fbfde3912bf907bab..abde60b0643833cc3f99449109ba3a40a1c65166 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
 # ext-http
 
 [![Build Status](https://travis-ci.org/m6w6/ext-http.svg?branch=master)](https://travis-ci.org/m6w6/ext-http)
+[![Coverity Scan Build Status](https://scan.coverity.com/projects/8711/badge.svg)](https://scan.coverity.com/projects/m6w6-ext-http)
 [![Join the chat at https://gitter.im/m6w6/ext-http](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/m6w6/ext-http)
 
 Extended HTTP support. Again.
diff --git a/scripts/coverity.sh b/scripts/coverity.sh
new file mode 100755 (executable)
index 0000000..08a04f1
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+set -e
+exec 1> /dev/null
+
+pushd $(dirname $(dirname $0))
+
+COVERITY_BIN=$(PATH="$PATH:/opt/coverity/bin" which cov-build)
+COVERITY_PROJECT=$(git ls-remote --get-url origin | sed 's/^.*:\(.*\)\.git$/\1/')
+COVERITY_BUILD_DATE=$(date --iso-8601=seconds)
+COVERITY_BUILD_BRANCH=$(git rev-parse --abbrev-ref HEAD)
+COVERITY_BUILD_DIR=$(mktemp -td coverity.XXXXXX)
+
+COVERITY_SCAN_TOKEN=$(gpg --quiet --decrypt < .coverity.asc)
+
+phpize
+./configure
+make clean
+
+$COVERITY_BIN --dir $COVERITY_BUILD_DIR/cov-int make -j8
+
+pushd $COVERITY_BUILD_DIR
+tar -czf cov-int{.tgz,}
+popd
+
+curl -sS\
+       --form "token=$COVERITY_SCAN_TOKEN" \
+       --form "version=$COVERITY_BUILD_BRANCH" \
+       --form "email=mike@php.net" \
+       --form "description=$COVERITY_BUILD_DATE" \
+       --form "file=@$COVERITY_BUILD_DIR/cov-int.tgz" \
+       --url "https://scan.coverity.com/builds?project=$COVERITY_PROJECT" >&2
+
+rm -r $COVERITY_BUILD_DIR
+
+popd