Radek Krejci | 562a800 | 2018-09-18 17:09:54 +0200 | [diff] [blame] | 1 | language: c |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 2 | sudo: required |
Radek Krejci | 00634fe | 2019-04-23 10:01:37 +0200 | [diff] [blame] | 3 | dist: xenial |
Radek Krejci | 034838b | 2019-04-05 10:13:59 +0200 | [diff] [blame] | 4 | branches: |
| 5 | only: |
| 6 | - libyang2 |
Radek Krejci | 12d5ec1 | 2019-04-18 15:45:40 +0200 | [diff] [blame] | 7 | cache: |
| 8 | directories: |
| 9 | - $HOME/cache |
Radek Krejci | 562a800 | 2018-09-18 17:09:54 +0200 | [diff] [blame] | 10 | |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 11 | stages: |
| 12 | - name: Test |
| 13 | if: type != cron |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 14 | - name: Coverity |
| 15 | if: type = cron |
Radek Krejci | 5b4b155 | 2019-04-04 13:15:13 +0200 | [diff] [blame] | 16 | |
Radek Krejci | b225882 | 2020-07-14 08:39:30 +0200 | [diff] [blame] | 17 | addons: |
| 18 | homebrew: |
| 19 | packages: |
| 20 | - cmocka |
Radek Krejci | 6e32ffc | 2020-11-25 13:35:20 +0100 | [diff] [blame] | 21 | - shunit2 |
| 22 | - expect |
Radek Krejci | b225882 | 2020-07-14 08:39:30 +0200 | [diff] [blame] | 23 | update: true |
| 24 | |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 25 | jobs: |
Radek Krejci | 562a800 | 2018-09-18 17:09:54 +0200 | [diff] [blame] | 26 | include: |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 27 | - stage: Coverity |
| 28 | name: Coverity night check |
| 29 | os: linux |
Radek Krejci | 562a800 | 2018-09-18 17:09:54 +0200 | [diff] [blame] | 30 | compiler: clang |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 31 | env: |
| 32 | # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created |
| 33 | # via the "travis encrypt" command using the project repo's public key |
| 34 | - secure: "jkN1i+W2V5/ULAmpqEOyl6J6hsa9rS8JcBKsjB/Md6sJJprWKepUfQ0UdhrjBYbFJbo1mnjL0sHboTrowBXH59IQquPtw64oF9HzyMcmwr+Dm93hhm/vaI06oXwkxmnQxC0OW7Cttrmo+858lsegZYxrh2p4tgEd6WOtDpJIaQ4=" |
Radek Krejci | d594a16 | 2019-04-04 13:39:05 +0200 | [diff] [blame] | 35 | addons: |
| 36 | coverity_scan: |
| 37 | project: |
| 38 | name: "CESNET/libyang" |
| 39 | notification_email: rkrejci@cesnet.cz |
Radek Iša | 9dc7ea1 | 2020-11-27 08:45:47 +0100 | [diff] [blame] | 40 | build_command_prepend: "mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make clean" |
Radek Krejci | d594a16 | 2019-04-04 13:39:05 +0200 | [diff] [blame] | 41 | build_command: "make" |
Radek Krejci | 034838b | 2019-04-05 10:13:59 +0200 | [diff] [blame] | 42 | branch_pattern: libyang2 |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 43 | before_install: |
Radek Krejci | 12d5ec1 | 2019-04-18 15:45:40 +0200 | [diff] [blame] | 44 | # check if something changed from the last coverity build |
Radek Krejci | 53dbb7e | 2019-04-23 10:26:09 +0200 | [diff] [blame] | 45 | - echo "Last coverity build on revision" `cat $HOME/cache/coveritybuild 2>/dev/null` |
| 46 | - echo "Current revision" `git rev-parse HEAD` |
Radek Krejci | 00634fe | 2019-04-23 10:01:37 +0200 | [diff] [blame] | 47 | - if [ "`git rev-parse HEAD`" = "`cat $HOME/cache/coveritybuild`" ]; then echo "Codebase did not change from previous build."; travis_terminate 0; fi |
Radek Krejci | 53dbb7e | 2019-04-23 10:26:09 +0200 | [diff] [blame] | 48 | - if [ ! -d $HOME/cache ]; then echo "Preparing revision cache."; mkdir -p $HOME/cache; fi |
Radek Krejci | 12d5ec1 | 2019-04-18 15:45:40 +0200 | [diff] [blame] | 49 | - git rev-parse HEAD > $HOME/cache/coveritybuild |
Radek Krejci | 53dbb7e | 2019-04-23 10:26:09 +0200 | [diff] [blame] | 50 | - cat $HOME/cache/coveritybuild |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 51 | - sudo apt-get update -qq |
Radek Krejci | 042c5ec | 2019-06-03 08:32:29 +0200 | [diff] [blame] | 52 | - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz |
| 53 | - tar -xzf pcre2-10.30.tar.gz |
| 54 | - cd pcre2-10.30 && ./configure && make -j2 && sudo -i -- sh -c 'cd /home/travis/build/CESNET/libyang/pcre2-10.30/ && make install' && cd .. |
Radek Krejci | a03e6a8 | 2019-04-23 16:07:14 +0200 | [diff] [blame] | 55 | # get everything for coverity |
| 56 | - 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 |
| 57 | - wget https://entrust.com/root-certificates/entrust_l1k.cer -O - | sudo tee -a /etc/ssl/certs/ca-certificates.crt |
Radek Krejci | ca9eccc | 2019-04-23 16:27:31 +0200 | [diff] [blame] | 58 | - export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 59 | script: |
| 60 | # do nothing, everything here is done in coverity addon |
| 61 | - true |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 62 | - stage: Test |
| 63 | name: Linux with CLang |
| 64 | os: linux |
| 65 | compiler: clang |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 66 | before_install: |
Radek Krejci | e868acc | 2020-11-13 16:42:58 +0100 | [diff] [blame] | 67 | - sudo apt-get update -qq && sudo apt-get install -y valgrind shunit2 expect |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 68 | - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz |
| 69 | - tar -xf cmocka-1.1.2.tar.xz |
Radek Krejci | 6d2a61a | 2019-05-16 10:23:34 +0200 | [diff] [blame] | 70 | - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../.. |
Radek Krejci | ad53ef1 | 2019-05-31 16:42:37 +0200 | [diff] [blame] | 71 | - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz |
| 72 | - tar -xzf pcre2-10.30.tar.gz |
Radek Krejci | 9a22d29 | 2019-05-31 18:17:03 +0200 | [diff] [blame] | 73 | - cd pcre2-10.30 && ./configure && make -j2 && sudo -i -- sh -c 'cd /home/travis/build/CESNET/libyang/pcre2-10.30/ && make install' && cd .. |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 74 | script: |
Radek Iša | 9dc7ea1 | 2020-11-27 08:45:47 +0100 | [diff] [blame] | 75 | - mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make -j2 && ctest --output-on-failure && cd - |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 76 | - stage: Test |
| 77 | name: Linux with GCC |
| 78 | os: linux |
| 79 | compiled: gcc |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 80 | before_install: |
Radek Krejci | e868acc | 2020-11-13 16:42:58 +0100 | [diff] [blame] | 81 | - sudo apt-get update -qq && sudo apt-get install -y valgrind shunit2 expect |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 82 | - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz |
| 83 | - tar -xf cmocka-1.1.2.tar.xz |
Radek Krejci | 6d2a61a | 2019-05-16 10:23:34 +0200 | [diff] [blame] | 84 | - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../.. |
Radek Krejci | ad53ef1 | 2019-05-31 16:42:37 +0200 | [diff] [blame] | 85 | - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz |
| 86 | - tar -xzf pcre2-10.30.tar.gz |
Radek Krejci | 05cf146 | 2019-05-31 16:58:09 +0200 | [diff] [blame] | 87 | - cd pcre2-10.30 && ./configure && make -j2 && sudo make install && cd .. |
Radek Iša | ce5096a | 2020-11-25 17:17:44 +0100 | [diff] [blame] | 88 | - pip install --user codecov |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 89 | script: |
Radek Iša | ce5096a | 2020-11-25 17:17:44 +0100 | [diff] [blame] | 90 | - mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ../ && make -j2 && ctest --output-on-failure && cd - |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 91 | after_success: |
Radek Krejci | 875f523 | 2020-06-02 16:32:31 +0200 | [diff] [blame] | 92 | - bash <(curl -s https://codecov.io/bash) |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 93 | - stage: Test |
Juraj Vijtiuk | f9fc4d2 | 2020-11-04 22:06:37 +0100 | [diff] [blame] | 94 | name: Linux with CLang ASAN and UBSAN |
| 95 | os: linux |
| 96 | compiler: clang |
| 97 | before_install: |
Radek Krejci | e868acc | 2020-11-13 16:42:58 +0100 | [diff] [blame] | 98 | - sudo apt-get update -qq && sudo apt-get install -y valgrind shunit2 expect |
Juraj Vijtiuk | f9fc4d2 | 2020-11-04 22:06:37 +0100 | [diff] [blame] | 99 | - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz |
| 100 | - tar -xf cmocka-1.1.2.tar.xz |
| 101 | - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../.. |
| 102 | - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz |
| 103 | - tar -xzf pcre2-10.30.tar.gz |
| 104 | - cd pcre2-10.30 && ./configure && make -j2 && sudo -i -- sh -c 'cd /home/travis/build/CESNET/libyang/pcre2-10.30/ && make install' && cd .. |
| 105 | script: |
Radek Iša | 9dc7ea1 | 2020-11-27 08:45:47 +0100 | [diff] [blame] | 106 | - mkdir build && cd build && cmake -DCMAKE_C_FLAGS="-fsanitize=address,undefined" -DENABLE_BUILD_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF .. && make -j2 && ctest --output-on-failure && cd - |
Juraj Vijtiuk | f9fc4d2 | 2020-11-04 22:06:37 +0100 | [diff] [blame] | 107 | - stage: Test |
Radek Krejci | b225882 | 2020-07-14 08:39:30 +0200 | [diff] [blame] | 108 | name: ABI check |
| 109 | os: linux |
| 110 | compiled: gcc |
| 111 | before_install: |
| 112 | - sudo apt-get update -qq && sudo apt-get install -y abi-dumper abi-compliance-checker |
| 113 | - sudo snap install core universal-ctags |
| 114 | - wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz |
| 115 | - tar -xzf pcre2-10.30.tar.gz |
| 116 | - cd pcre2-10.30 && ./configure && make -j2 && sudo make install && cd .. |
| 117 | script: |
| 118 | - mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=ABICheck .. && LC_ALL=C.UTF-8 PATH=/snap/bin:$PATH make abi-check && cd - |
| 119 | - stage: Test |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 120 | name: OS X with GCC |
| 121 | os: osx |
Radek Krejci | 562a800 | 2018-09-18 17:09:54 +0200 | [diff] [blame] | 122 | compiler: gcc |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 123 | allow_failures: |
| 124 | - os: osx |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 125 | script: |
Radek Iša | 9dc7ea1 | 2020-11-27 08:45:47 +0100 | [diff] [blame] | 126 | - mkdir build && cd build && cmake -DENABLE_BUILD_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF .. && make -j2 && ctest --output-on-failure && cd - |
Radek Iša | ce5096a | 2020-11-25 17:17:44 +0100 | [diff] [blame] | 127 | |