blob: baf90170f75073cdb1365f8c0eec5d55ec6111f2 [file] [log] [blame]
Radek Krejci562a8002018-09-18 17:09:54 +02001language: c
Radek Krejci48c987e2019-04-04 11:39:45 +02002sudo: required
Radek Krejci00634fe2019-04-23 10:01:37 +02003dist: xenial
Radek Krejci034838b2019-04-05 10:13:59 +02004branches:
5 only:
6 - libyang2
Radek Krejci12d5ec12019-04-18 15:45:40 +02007cache:
8 directories:
9 - $HOME/cache
Radek Krejci562a8002018-09-18 17:09:54 +020010
Radek Krejci48c987e2019-04-04 11:39:45 +020011stages:
12 - name: Test
13 if: type != cron
Radek Krejci48c987e2019-04-04 11:39:45 +020014 - name: Coverity
15 if: type = cron
Radek Krejci5b4b1552019-04-04 13:15:13 +020016
Radek Krejci48c987e2019-04-04 11:39:45 +020017jobs:
Radek Krejci562a8002018-09-18 17:09:54 +020018 include:
Radek Krejci48c987e2019-04-04 11:39:45 +020019 - stage: Coverity
20 name: Coverity night check
21 os: linux
Radek Krejci562a8002018-09-18 17:09:54 +020022 compiler: clang
Radek Krejci4d271eb2019-04-04 11:53:00 +020023 env:
24 # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
25 # via the "travis encrypt" command using the project repo's public key
26 - secure: "jkN1i+W2V5/ULAmpqEOyl6J6hsa9rS8JcBKsjB/Md6sJJprWKepUfQ0UdhrjBYbFJbo1mnjL0sHboTrowBXH59IQquPtw64oF9HzyMcmwr+Dm93hhm/vaI06oXwkxmnQxC0OW7Cttrmo+858lsegZYxrh2p4tgEd6WOtDpJIaQ4="
Radek Krejcid594a162019-04-04 13:39:05 +020027 addons:
28 coverity_scan:
29 project:
30 name: "CESNET/libyang"
31 notification_email: rkrejci@cesnet.cz
Radek Krejci6d2a61a2019-05-16 10:23:34 +020032 build_command_prepend: "mkdir build && cd build && cmake .. && make clean"
Radek Krejcid594a162019-04-04 13:39:05 +020033 build_command: "make"
Radek Krejci034838b2019-04-05 10:13:59 +020034 branch_pattern: libyang2
Radek Krejci4d271eb2019-04-04 11:53:00 +020035 before_install:
Radek Krejci86364422019-05-02 08:38:25 +020036 - sudo apt-get install libpcre2-dev
Radek Krejci12d5ec12019-04-18 15:45:40 +020037 # check if something changed from the last coverity build
Radek Krejci53dbb7e2019-04-23 10:26:09 +020038 - echo "Last coverity build on revision" `cat $HOME/cache/coveritybuild 2>/dev/null`
39 - echo "Current revision" `git rev-parse HEAD`
Radek Krejci00634fe2019-04-23 10:01:37 +020040 - if [ "`git rev-parse HEAD`" = "`cat $HOME/cache/coveritybuild`" ]; then echo "Codebase did not change from previous build."; travis_terminate 0; fi
Radek Krejci53dbb7e2019-04-23 10:26:09 +020041 - if [ ! -d $HOME/cache ]; then echo "Preparing revision cache."; mkdir -p $HOME/cache; fi
Radek Krejci12d5ec12019-04-18 15:45:40 +020042 - git rev-parse HEAD > $HOME/cache/coveritybuild
Radek Krejci53dbb7e2019-04-23 10:26:09 +020043 - cat $HOME/cache/coveritybuild
Radek Krejci4d271eb2019-04-04 11:53:00 +020044 - sudo apt-get update -qq
Radek Krejcia03e6a82019-04-23 16:07:14 +020045 # get everything for coverity
46 - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
47 - wget https://entrust.com/root-certificates/entrust_l1k.cer -O - | sudo tee -a /etc/ssl/certs/ca-certificates.crt
Radek Krejcica9eccc2019-04-23 16:27:31 +020048 - export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
Radek Krejci4d271eb2019-04-04 11:53:00 +020049 script:
50 # do nothing, everything here is done in coverity addon
51 - true
Radek Krejci48c987e2019-04-04 11:39:45 +020052 - stage: Test
53 name: Linux with CLang
54 os: linux
55 compiler: clang
Radek Krejci4d271eb2019-04-04 11:53:00 +020056 before_install:
Radek Krejciad53ef12019-05-31 16:42:37 +020057 - sudo apt-get update -qq && sudo apt-get install -y valgrind
Radek Krejci4d271eb2019-04-04 11:53:00 +020058 - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz
59 - tar -xf cmocka-1.1.2.tar.xz
Radek Krejci6d2a61a2019-05-16 10:23:34 +020060 - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../..
Radek Krejciad53ef12019-05-31 16:42:37 +020061 - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
62 - tar -xzf pcre2-10.30.tar.gz
Radek Krejci031c13c2019-05-31 18:10:10 +020063 - cd pcre2-10.30 && ./configure && make -j2 && sudo -i -- sh -c 'cd /home/travis/pcre2-10.30/ && make install' && cd ..
Radek Krejci4d271eb2019-04-04 11:53:00 +020064 script:
Radek Krejci6d2a61a2019-05-16 10:23:34 +020065 - mkdir build && cd build && cmake .. && make -j2 && ctest --output-on-failure && cd -
Radek Krejci48c987e2019-04-04 11:39:45 +020066 - stage: Test
67 name: Linux with GCC
68 os: linux
69 compiled: gcc
Radek Krejci4d271eb2019-04-04 11:53:00 +020070 before_install:
Radek Krejciad53ef12019-05-31 16:42:37 +020071 - sudo apt-get update -qq && sudo apt-get install -y valgrind
Radek Krejci4d271eb2019-04-04 11:53:00 +020072 - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz
73 - tar -xf cmocka-1.1.2.tar.xz
Radek Krejci6d2a61a2019-05-16 10:23:34 +020074 - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../..
Radek Krejciad53ef12019-05-31 16:42:37 +020075 - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
76 - tar -xzf pcre2-10.30.tar.gz
Radek Krejci05cf1462019-05-31 16:58:09 +020077 - cd pcre2-10.30 && ./configure && make -j2 && sudo make install && cd ..
Radek Krejci6d2a61a2019-05-16 10:23:34 +020078 - pip install --user codecov && export CFLAGS="-coverage"
Radek Krejci4d271eb2019-04-04 11:53:00 +020079 script:
Radek Krejci6d2a61a2019-05-16 10:23:34 +020080 - mkdir build && cd build && cmake .. && make -j2 && ctest --output-on-failure && cd -
Radek Krejci4d271eb2019-04-04 11:53:00 +020081 after_success:
82 - codecov
Radek Krejci48c987e2019-04-04 11:39:45 +020083 - stage: Test
84 name: OS X with GCC
85 os: osx
Radek Krejci562a8002018-09-18 17:09:54 +020086 compiler: gcc
Radek Krejci48c987e2019-04-04 11:39:45 +020087 allow_failures:
88 - os: osx
Radek Krejci4d271eb2019-04-04 11:53:00 +020089 before_install:
90 - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz
91 - tar -xf cmocka-1.1.2.tar.xz
Radek Krejci6d2a61a2019-05-16 10:23:34 +020092 - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../..
Radek Krejci4d271eb2019-04-04 11:53:00 +020093 - brew update
Radek Krejcifdb1b382019-05-02 08:48:26 +020094 - brew install pcre2
Radek Krejci4d271eb2019-04-04 11:53:00 +020095 script:
Radek Krejci6d2a61a2019-05-16 10:23:34 +020096 - mkdir build && cd build && cmake -DENABLE_VALGRIND_TESTS=OFF .. && make -j2 && ctest --output-on-failure && cd -
97