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 | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 17 | jobs: |
Radek Krejci | 562a800 | 2018-09-18 17:09:54 +0200 | [diff] [blame] | 18 | include: |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 19 | - stage: Coverity |
| 20 | name: Coverity night check |
| 21 | os: linux |
Radek Krejci | 562a800 | 2018-09-18 17:09:54 +0200 | [diff] [blame] | 22 | compiler: clang |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 23 | 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 Krejci | d594a16 | 2019-04-04 13:39:05 +0200 | [diff] [blame] | 27 | addons: |
| 28 | coverity_scan: |
| 29 | project: |
| 30 | name: "CESNET/libyang" |
| 31 | notification_email: rkrejci@cesnet.cz |
Radek Krejci | 6d2a61a | 2019-05-16 10:23:34 +0200 | [diff] [blame] | 32 | build_command_prepend: "mkdir build && cd build && cmake .. && make clean" |
Radek Krejci | d594a16 | 2019-04-04 13:39:05 +0200 | [diff] [blame] | 33 | build_command: "make" |
Radek Krejci | 034838b | 2019-04-05 10:13:59 +0200 | [diff] [blame] | 34 | branch_pattern: libyang2 |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 35 | before_install: |
Radek Krejci | 8636442 | 2019-05-02 08:38:25 +0200 | [diff] [blame] | 36 | - sudo apt-get install libpcre2-dev |
Radek Krejci | 12d5ec1 | 2019-04-18 15:45:40 +0200 | [diff] [blame] | 37 | # check if something changed from the last coverity build |
Radek Krejci | 53dbb7e | 2019-04-23 10:26:09 +0200 | [diff] [blame] | 38 | - echo "Last coverity build on revision" `cat $HOME/cache/coveritybuild 2>/dev/null` |
| 39 | - echo "Current revision" `git rev-parse HEAD` |
Radek Krejci | 00634fe | 2019-04-23 10:01:37 +0200 | [diff] [blame] | 40 | - 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] | 41 | - 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] | 42 | - git rev-parse HEAD > $HOME/cache/coveritybuild |
Radek Krejci | 53dbb7e | 2019-04-23 10:26:09 +0200 | [diff] [blame] | 43 | - cat $HOME/cache/coveritybuild |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 44 | - sudo apt-get update -qq |
Radek Krejci | a03e6a8 | 2019-04-23 16:07:14 +0200 | [diff] [blame] | 45 | # 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 Krejci | ca9eccc | 2019-04-23 16:27:31 +0200 | [diff] [blame] | 48 | - export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 49 | script: |
| 50 | # do nothing, everything here is done in coverity addon |
| 51 | - true |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 52 | - stage: Test |
| 53 | name: Linux with CLang |
| 54 | os: linux |
| 55 | compiler: clang |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 56 | before_install: |
| 57 | - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz |
| 58 | - tar -xf cmocka-1.1.2.tar.xz |
Radek Krejci | 6d2a61a | 2019-05-16 10:23:34 +0200 | [diff] [blame] | 59 | - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../.. |
| 60 | - sudo apt-get update -qq && sudo apt-get install -y valgrind libpcre2-dev |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 61 | script: |
Radek Krejci | 6d2a61a | 2019-05-16 10:23:34 +0200 | [diff] [blame] | 62 | - mkdir build && cd build && cmake .. && make -j2 && ctest --output-on-failure && cd - |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 63 | - stage: Test |
| 64 | name: Linux with GCC |
| 65 | os: linux |
| 66 | compiled: gcc |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 67 | before_install: |
| 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 ../.. |
| 71 | - sudo apt-get update -qq && sudo apt-get install -y valgrind libpcre2-dev |
| 72 | - pip install --user codecov && export CFLAGS="-coverage" |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 73 | script: |
Radek Krejci | 6d2a61a | 2019-05-16 10:23:34 +0200 | [diff] [blame] | 74 | - mkdir build && cd build && cmake .. && make -j2 && ctest --output-on-failure && cd - |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 75 | after_success: |
| 76 | - codecov |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 77 | - stage: Test |
| 78 | name: OS X with GCC |
| 79 | os: osx |
Radek Krejci | 562a800 | 2018-09-18 17:09:54 +0200 | [diff] [blame] | 80 | compiler: gcc |
Radek Krejci | 48c987e | 2019-04-04 11:39:45 +0200 | [diff] [blame] | 81 | allow_failures: |
| 82 | - os: osx |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 83 | before_install: |
| 84 | - wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz |
| 85 | - tar -xf cmocka-1.1.2.tar.xz |
Radek Krejci | 6d2a61a | 2019-05-16 10:23:34 +0200 | [diff] [blame] | 86 | - cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../.. |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 87 | - brew update |
Radek Krejci | fdb1b38 | 2019-05-02 08:48:26 +0200 | [diff] [blame] | 88 | - brew install pcre2 |
Radek Krejci | 4d271eb | 2019-04-04 11:53:00 +0200 | [diff] [blame] | 89 | script: |
Radek Krejci | 6d2a61a | 2019-05-16 10:23:34 +0200 | [diff] [blame] | 90 | - mkdir build && cd build && cmake -DENABLE_VALGRIND_TESTS=OFF .. && make -j2 && ctest --output-on-failure && cd - |
| 91 | |