suppress new PHP-7.4 notice about failed stream_write
[m6w6/ext-http] / scripts / coverity.sh
1 #!/bin/bash
2
3 set -e
4 exec 1> /dev/null
5
6 pushd $(dirname $(dirname $0))
7
8 COVERITY_BIN=$(PATH="$PATH:/opt/coverity/bin" which cov-build)
9 COVERITY_PROJECT=$(git ls-remote --get-url origin | sed 's/^.*:\(.*\)\.git$/\1/')
10 COVERITY_BUILD_DATE=$(date --iso-8601=seconds)
11 COVERITY_BUILD_BRANCH=$(git rev-parse --abbrev-ref HEAD)
12 COVERITY_BUILD_DIR=$(mktemp -td coverity.XXXXXX)
13
14 COVERITY_SCAN_TOKEN=$(gpg --quiet --decrypt < .coverity.asc)
15
16 phpize
17 ./configure
18 make clean
19
20
21 $COVERITY_BIN --dir $COVERITY_BUILD_DIR/cov-int make -j8
22
23 echo >&2
24 echo -n "Submit results to scan.coverity.com? (y/N) " >&2
25 read submit
26 echo >&2
27
28 if test "$submit" != "y"; then
29 exit
30 fi
31
32 pushd $COVERITY_BUILD_DIR
33 tar -czf cov-int{.tgz,}
34 popd
35
36 curl -sS\
37 --form "token=$COVERITY_SCAN_TOKEN" \
38 --form "version=$COVERITY_BUILD_BRANCH" \
39 --form "email=mike@php.net" \
40 --form "description=$COVERITY_BUILD_DATE" \
41 --form "file=@$COVERITY_BUILD_DIR/cov-int.tgz" \
42 --url "https://scan.coverity.com/builds?project=$COVERITY_PROJECT" >&2
43
44 rm -r $COVERITY_BUILD_DIR
45
46 popd