blob: 799bb8ff543399fc8f71889a9584c842de5c85e8 [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 Krejcib2258822020-07-14 08:39:30 +020017addons:
18 homebrew:
19 packages:
20 - cmocka
21 update: true
22
Radek Krejci48c987e2019-04-04 11:39:45 +020023jobs:
Radek Krejci562a8002018-09-18 17:09:54 +020024 include:
Radek Krejci48c987e2019-04-04 11:39:45 +020025 - stage: Coverity
26 name: Coverity night check
27 os: linux
Radek Krejci562a8002018-09-18 17:09:54 +020028 compiler: clang
Radek Krejci4d271eb2019-04-04 11:53:00 +020029 env:
30 # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
31 # via the "travis encrypt" command using the project repo's public key
32 - secure: "jkN1i+W2V5/ULAmpqEOyl6J6hsa9rS8JcBKsjB/Md6sJJprWKepUfQ0UdhrjBYbFJbo1mnjL0sHboTrowBXH59IQquPtw64oF9HzyMcmwr+Dm93hhm/vaI06oXwkxmnQxC0OW7Cttrmo+858lsegZYxrh2p4tgEd6WOtDpJIaQ4="
Radek Krejcid594a162019-04-04 13:39:05 +020033 addons:
34 coverity_scan:
35 project:
36 name: "CESNET/libyang"
37 notification_email: rkrejci@cesnet.cz
Radek Krejci6d2a61a2019-05-16 10:23:34 +020038 build_command_prepend: "mkdir build && cd build && cmake .. && make clean"
Radek Krejcid594a162019-04-04 13:39:05 +020039 build_command: "make"
Radek Krejci034838b2019-04-05 10:13:59 +020040 branch_pattern: libyang2
Radek Krejci4d271eb2019-04-04 11:53:00 +020041 before_install:
Radek Krejci12d5ec12019-04-18 15:45:40 +020042 # check if something changed from the last coverity build
Radek Krejci53dbb7e2019-04-23 10:26:09 +020043 - echo "Last coverity build on revision" `cat $HOME/cache/coveritybuild 2>/dev/null`
44 - echo "Current revision" `git rev-parse HEAD`
Radek Krejci00634fe2019-04-23 10:01:37 +020045 - 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 +020046 - if [ ! -d $HOME/cache ]; then echo "Preparing revision cache."; mkdir -p $HOME/cache; fi
Radek Krejci12d5ec12019-04-18 15:45:40 +020047 - git rev-parse HEAD > $HOME/cache/coveritybuild
Radek Krejci53dbb7e2019-04-23 10:26:09 +020048 - cat $HOME/cache/coveritybuild
Radek Krejci4d271eb2019-04-04 11:53:00 +020049 - sudo apt-get update -qq
Radek Krejci042c5ec2019-06-03 08:32:29 +020050 - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
51 - tar -xzf pcre2-10.30.tar.gz
52 - cd pcre2-10.30 && ./configure && make -j2 && sudo -i -- sh -c 'cd /home/travis/build/CESNET/libyang/pcre2-10.30/ && make install' && cd ..
Radek Krejcia03e6a82019-04-23 16:07:14 +020053 # get everything for coverity
54 - 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
55 - 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 +020056 - export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
Radek Krejci4d271eb2019-04-04 11:53:00 +020057 script:
58 # do nothing, everything here is done in coverity addon
59 - true
Radek Krejci48c987e2019-04-04 11:39:45 +020060 - stage: Test
61 name: Linux with CLang
62 os: linux
63 compiler: clang
Radek Krejci4d271eb2019-04-04 11:53:00 +020064 before_install:
Radek Krejciad53ef12019-05-31 16:42:37 +020065 - sudo apt-get update -qq && sudo apt-get install -y valgrind
Radek Krejci4d271eb2019-04-04 11:53:00 +020066 - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz
67 - tar -xf cmocka-1.1.2.tar.xz
Radek Krejci6d2a61a2019-05-16 10:23:34 +020068 - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../..
Radek Krejciad53ef12019-05-31 16:42:37 +020069 - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
70 - tar -xzf pcre2-10.30.tar.gz
Radek Krejci9a22d292019-05-31 18:17:03 +020071 - cd pcre2-10.30 && ./configure && make -j2 && sudo -i -- sh -c 'cd /home/travis/build/CESNET/libyang/pcre2-10.30/ && make install' && cd ..
Radek Krejci4d271eb2019-04-04 11:53:00 +020072 script:
Radek Krejci6d2a61a2019-05-16 10:23:34 +020073 - mkdir build && cd build && cmake .. && make -j2 && ctest --output-on-failure && cd -
Radek Krejci48c987e2019-04-04 11:39:45 +020074 - stage: Test
75 name: Linux with GCC
76 os: linux
77 compiled: gcc
Radek Krejci4d271eb2019-04-04 11:53:00 +020078 before_install:
Radek Krejciad53ef12019-05-31 16:42:37 +020079 - sudo apt-get update -qq && sudo apt-get install -y valgrind
Radek Krejci4d271eb2019-04-04 11:53:00 +020080 - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz
81 - tar -xf cmocka-1.1.2.tar.xz
Radek Krejci6d2a61a2019-05-16 10:23:34 +020082 - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../..
Radek Krejciad53ef12019-05-31 16:42:37 +020083 - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
84 - tar -xzf pcre2-10.30.tar.gz
Radek Krejci05cf1462019-05-31 16:58:09 +020085 - cd pcre2-10.30 && ./configure && make -j2 && sudo make install && cd ..
Radek Krejci6d2a61a2019-05-16 10:23:34 +020086 - pip install --user codecov && export CFLAGS="-coverage"
Radek Krejci4d271eb2019-04-04 11:53:00 +020087 script:
Radek Krejci6d2a61a2019-05-16 10:23:34 +020088 - mkdir build && cd build && cmake .. && make -j2 && ctest --output-on-failure && cd -
Radek Krejci4d271eb2019-04-04 11:53:00 +020089 after_success:
Radek Krejci875f5232020-06-02 16:32:31 +020090 - bash <(curl -s https://codecov.io/bash)
Radek Krejci48c987e2019-04-04 11:39:45 +020091 - stage: Test
Juraj Vijtiukf9fc4d22020-11-04 22:06:37 +010092 name: Linux with CLang ASAN and UBSAN
93 os: linux
94 compiler: clang
95 before_install:
96 - sudo apt-get update -qq && sudo apt-get install -y valgrind
97 - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz
98 - tar -xf cmocka-1.1.2.tar.xz
99 - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../..
100 - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
101 - tar -xzf pcre2-10.30.tar.gz
102 - cd pcre2-10.30 && ./configure && make -j2 && sudo -i -- sh -c 'cd /home/travis/build/CESNET/libyang/pcre2-10.30/ && make install' && cd ..
103 script:
104 - mkdir build && cd build && cmake -DCMAKE_C_FLAGS="-fsanitize=address,undefined" -DENABLE_VALGRIND_TESTS=OFF .. && make -j2 && ctest --output-on-failure && cd -
105 - stage: Test
Radek Krejcib2258822020-07-14 08:39:30 +0200106 name: ABI check
107 os: linux
108 compiled: gcc
109 before_install:
110 - sudo apt-get update -qq && sudo apt-get install -y abi-dumper abi-compliance-checker
111 - sudo snap install core universal-ctags
112 - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
113 - tar -xzf pcre2-10.30.tar.gz
114 - cd pcre2-10.30 && ./configure && make -j2 && sudo make install && cd ..
115 script:
116 - mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=ABICheck .. && LC_ALL=C.UTF-8 PATH=/snap/bin:$PATH make abi-check && cd -
117 - stage: Test
Radek Krejci48c987e2019-04-04 11:39:45 +0200118 name: OS X with GCC
119 os: osx
Radek Krejci562a8002018-09-18 17:09:54 +0200120 compiler: gcc
Radek Krejci48c987e2019-04-04 11:39:45 +0200121 allow_failures:
122 - os: osx
Radek Krejci4d271eb2019-04-04 11:53:00 +0200123 script:
Radek Krejci6d2a61a2019-05-16 10:23:34 +0200124 - mkdir build && cd build && cmake -DENABLE_VALGRIND_TESTS=OFF .. && make -j2 && ctest --output-on-failure && cd -
Radek Krejcib2258822020-07-14 08:39:30 +0200125