summaryrefslogtreecommitdiffstats
path: root/.travis.yml
blob: d980038181c5b37725565eb36d8484f40f02de1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
sudo: required

services:
    - docker

language: c

jobs:
    include:
        - stage: coverity scan
          before_script:
              - sudo apt-get update
              - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
              - docker --version
              - env > .env
          env:
              - COVERITY_SCAN_PROJECT_NAME="$TRAVIS_REPO_SLUG"
              - COVERITY_SCAN_NOTIFICATION_EMAIL="${AUTHOR_EMAIL}"
              - COVERITY_SCAN_BRANCH_PATTERN="$TRAVIS_BRANCH"
              # Encrypted token for systemd/systemd Coverity Scan Analysis,
              # generated by "travis encrypt -r systemd/systemd COVERITY_SCAN_TOKEN=<TOKEN>"
              - secure: "lM0IVP2zOG5Ywk3YCbDCQL4WioyzzwtdtpZ+hKDy4BWCZDBJ/FVwIeBsXdMDvlTa3xi+GQ1b7kS2OmTfmG4aSlhU7isuH8SMq1Y4GR5AxfhkR+irUA1A1fntlvhbjIumDGW5wjs0Dt8KogMWS+ZD4eGE59lrVO/TrhMzIe1eHENVLFQJdNq+ZJXU8wxMfHf8lXk0xA8SJTid0XvZBNc4JN6pjJRA8LaOrMNhQYfygFmVQ598kwlu7gf5vbCKFPnIgJAxdIhz12XS9utGohV28IYj9d1DdUGUT+ar3OfADj3X8KFBP4Ymc02pcln3wVgdPtrDbFZh1R9jbmfdXGAH/6tTOJVn8aFySS2Vq9QiBiprWdPsAOLcWMNhnp0lMkASxs9/W26nU7Czo8VbAVWXM1w35plDpnDGR6lk/06dmOZpqu5p3AYr5xIKACIAdPDn0rNpnSWqC750WZ8ZWbHnKuZC5TWML7scVaPiEi7D7rbwqML2rdwx4ZoTZmCHiGByXCIWTfhf0JNQAix5WW3znl+BmDesumPgPj2mX+y6J1WYJrIz12m7qh7KhV/a1ODKM+I91A9rkOA/bPnmhmSSUR7CwgvZt1fC/VwBnaFFtAz9/70kN9Q8tDBXtXidExZwh1e3t5vDG72k3lXwNqpKRvdW3LOxK6lFvqEdMWVUJls="
          script:
                # Copy content of CI_DIR into WORKDIR
              - find $CI_DIR -maxdepth 1 -type f -exec cp -t . {} +
                # Build container for current user
              - $CI_SCRIPT_DIR/build-docker-image.sh

                # For kernel version 4.8+
              - sudo sysctl vsyscall=emulate || true
                # Prepare environment for Coverity tool
              - |
                  PLATFORM=`uname`
                  export TOOL_BASE="/tmp/coverity-scan-analysis"
                  export SCAN_URL="https://scan.coverity.com"
                  export UPLOAD_URL="https://scan.coverity.com/builds"
                  export TOOL_ARCHIVE="/tmp/cov-analysis-${PLATFORM}.tgz"

                # Get Coverity tool
              - $CI_TOOL_DIR/get-coverity.sh
              - TOOL_DIR="$(find $TOOL_BASE -type d -name 'cov-analysis*')"

                # Export env variables for Coverity scan
              - env | grep -E "TRAVIS|COV|TOOL|URL" > .cov-env
              - |
                  docker run -dit --env-file .cov-env \
                  -v ${TOOL_BASE}:${TOOL_BASE}:ro \
                  --name travis_coverity_scan coverity-${TRAVIS_COMMIT}:latest bash
                # Make sure Coverity script is executable
              - docker cp tools/coverity.sh travis_coverity_scan:/usr/local/bin
                # Preconfigure with meson to prevent Coverity from capturing meson metadata
                # Set compiler flag to prevent emit failure
              - docker exec -it travis_coverity_scan sh -c "CFLAGS='-D_Float128=long\ double -D_Float64=double -D_Float64x=long\ double -D_Float32=float -D_Float32x=double' meson cov-build -Dman=false"
                # Run Coverity Analysis
              - docker exec -it travis_coverity_scan coverity.sh build
              - docker exec -it travis_coverity_scan coverity.sh upload

# Specify the order of stages and conditions
stages:
    - name: coverity scan
      if: type = cron

env:
    global:
        - ADMIN_EMAIL=macermak@redhat.com

        - AUTHOR_NAME="$(git log -1 $TRAVIS_COMMIT --pretty=\"%aN\")"
        - AUTHOR_EMAIL="$(git log -1 $TRAVIS_COMMIT --pretty=\"%aE\")"

        - CI_DIR="$TRAVIS_BUILD_DIR/travis-ci"
        - CI_TOOL_DIR="$CI_DIR/tools"
        - CI_SCRIPT_DIR="$CI_DIR/scripts"

notifications:
  email:
    recipients:
      - ${ADMIN_EMAIL}