diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2018-07-27 12:31:32 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2018-07-28 23:54:46 +0100 |
| commit | 24b8dd8275adb13acc68281c200623f636690666 (patch) | |
| tree | 93411ae720cb23a4818a85cdf685999822fcdec0 /ci | |
| parent | 465f8b5163cdee708a6ee81a7c210b2a8baedde4 (diff) | |
| download | libgit2-24b8dd8275adb13acc68281c200623f636690666.tar.gz | |
ci: move travis to the new scripts
Diffstat (limited to 'ci')
| -rwxr-xr-x | ci/coverity.sh | 68 | ||||
| -rwxr-xr-x | ci/setup-linux.sh | 23 | ||||
| -rwxr-xr-x | ci/setup-osx.sh (renamed from ci/setup-macos.sh) | 0 |
3 files changed, 89 insertions, 2 deletions
diff --git a/ci/coverity.sh b/ci/coverity.sh new file mode 100755 index 000000000..57f411174 --- /dev/null +++ b/ci/coverity.sh @@ -0,0 +1,68 @@ +#!/bin/bash +set -e + +# Only run this on our branches +echo "Branch: $TRAVIS_BRANCH | Pull request: $TRAVIS_PULL_REQUEST | Slug: $TRAVIS_REPO_SLUG" +if [ "$TRAVIS_BRANCH" != "master" -o "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "libgit2/libgit2" ]; +then + echo "Only analyzing the 'master' brach of the main repository." + exit 0 +fi + +# Environment check +[ -z "$COVERITY_TOKEN" ] && echo "Need to set a coverity token" && exit 1 + +case $(uname -m) in + i?86) BITS=32 ;; + amd64|x86_64) BITS=64 ;; +esac +SCAN_TOOL=https://scan.coverity.com/download/cxx/linux${BITS} +TOOL_BASE=$(pwd)/_coverity-scan + +# Install coverity tools +if [ ! -d "$TOOL_BASE" ]; then + echo "Downloading coverity..." + mkdir -p "$TOOL_BASE" + pushd "$TOOL_BASE" + wget -O coverity_tool.tgz $SCAN_TOOL \ + --post-data "project=libgit2&token=$COVERITY_TOKEN" + tar xzf coverity_tool.tgz + popd + TOOL_DIR=$(find "$TOOL_BASE" -type d -name 'cov-analysis*') + ln -s "$TOOL_DIR" "$TOOL_BASE"/cov-analysis +fi + +cp ../script/user_nodefs.h "$TOOL_BASE"/cov-analysis/config/user_nodefs.h + +COV_BUILD="$TOOL_BASE/cov-analysis/bin/cov-build" + +# Configure and build +cmake .. -DTHREADSAFE=ON +COVERITY_UNSUPPORTED=1 \ + $COV_BUILD --dir cov-int \ + cmake --build . + +# Upload results +tar czf libgit2.tgz cov-int +SHA=$(git rev-parse --short HEAD) + +HTML="$(curl \ + --silent \ + --write-out "\n%{http_code}" \ + --form token="$COVERITY_TOKEN" \ + --form email=bs@github.com \ + --form file=@libgit2.tgz \ + --form version="$SHA" \ + --form description="Travis build" \ + https://scan.coverity.com/builds?project=libgit2)" +# Body is everything up to the last line +BODY="$(echo "$HTML" | head -n-1)" +# Status code is the last line +STATUS_CODE="$(echo "$HTML" | tail -n1)" + +echo "${BODY}" + +if [ "${STATUS_CODE}" != "201" ]; then + echo "Received error code ${STATUS_CODE} from Coverity" + exit 1 +fi diff --git a/ci/setup-linux.sh b/ci/setup-linux.sh index 03e4a1d2f..c5ecb550b 100755 --- a/ci/setup-linux.sh +++ b/ci/setup-linux.sh @@ -1,8 +1,27 @@ #!/bin/sh +set -e set -x -apt-get update -apt-get -y install build-essential pkg-config clang cmake openssl libssl-dev libssh2-1-dev libcurl4-gnutls-dev openssh-server +TMPDIR=${TMPDIR:-/tmp} + +if [ -z "$SKIP_APT" ]; then + apt-get update + apt-get -y install build-essential pkg-config clang cmake openssl libssl-dev libssh2-1-dev libcurl4-gnutls-dev openssh-server +fi mkdir -p /var/run/sshd + +if [ "$MBEDTLS" ]; then + MBEDTLS_DIR=${MBEDTLS_DIR:-$(mktemp -d ${TMPDIR}/mbedtls.XXXXXXXX)} + + git clone --depth 10 --single-branch --branch mbedtls-2.6.1 https://github.com/ARMmbed/mbedtls.git ${MBEDTLS_DIR} + cd ${MBEDTLS_DIR} + + CFLAGS=-fPIC cmake -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON . + cmake --build . + + if [ -z "$SKIP_MBEDTLS_INSTALL" ]; then + make install + fi +fi diff --git a/ci/setup-macos.sh b/ci/setup-osx.sh index 564910e41..564910e41 100755 --- a/ci/setup-macos.sh +++ b/ci/setup-osx.sh |
