blob: 799bb8ff543399fc8f71889a9584c842de5c85e8 [file] [log] [blame]
language: c
sudo: required
dist: xenial
branches:
only:
- libyang2
cache:
directories:
- $HOME/cache
stages:
- name: Test
if: type != cron
- name: Coverity
if: type = cron
addons:
homebrew:
packages:
- cmocka
update: true
jobs:
include:
- stage: Coverity
name: Coverity night check
os: linux
compiler: clang
env:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "jkN1i+W2V5/ULAmpqEOyl6J6hsa9rS8JcBKsjB/Md6sJJprWKepUfQ0UdhrjBYbFJbo1mnjL0sHboTrowBXH59IQquPtw64oF9HzyMcmwr+Dm93hhm/vaI06oXwkxmnQxC0OW7Cttrmo+858lsegZYxrh2p4tgEd6WOtDpJIaQ4="
addons:
coverity_scan:
project:
name: "CESNET/libyang"
notification_email: rkrejci@cesnet.cz
build_command_prepend: "mkdir build && cd build && cmake .. && make clean"
build_command: "make"
branch_pattern: libyang2
before_install:
# check if something changed from the last coverity build
- echo "Last coverity build on revision" `cat $HOME/cache/coveritybuild 2>/dev/null`
- echo "Current revision" `git rev-parse HEAD`
- if [ "`git rev-parse HEAD`" = "`cat $HOME/cache/coveritybuild`" ]; then echo "Codebase did not change from previous build."; travis_terminate 0; fi
- if [ ! -d $HOME/cache ]; then echo "Preparing revision cache."; mkdir -p $HOME/cache; fi
- git rev-parse HEAD > $HOME/cache/coveritybuild
- cat $HOME/cache/coveritybuild
- sudo apt-get update -qq
- wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
- tar -xzf pcre2-10.30.tar.gz
- cd pcre2-10.30 && ./configure && make -j2 && sudo -i -- sh -c 'cd /home/travis/build/CESNET/libyang/pcre2-10.30/ && make install' && cd ..
# get everything for coverity
- 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
- wget https://entrust.com/root-certificates/entrust_l1k.cer -O - | sudo tee -a /etc/ssl/certs/ca-certificates.crt
- export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
script:
# do nothing, everything here is done in coverity addon
- true
- stage: Test
name: Linux with CLang
os: linux
compiler: clang
before_install:
- sudo apt-get update -qq && sudo apt-get install -y valgrind
- wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz
- tar -xf cmocka-1.1.2.tar.xz
- cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../..
- wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
- tar -xzf pcre2-10.30.tar.gz
- cd pcre2-10.30 && ./configure && make -j2 && sudo -i -- sh -c 'cd /home/travis/build/CESNET/libyang/pcre2-10.30/ && make install' && cd ..
script:
- mkdir build && cd build && cmake .. && make -j2 && ctest --output-on-failure && cd -
- stage: Test
name: Linux with GCC
os: linux
compiled: gcc
before_install:
- sudo apt-get update -qq && sudo apt-get install -y valgrind
- wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz
- tar -xf cmocka-1.1.2.tar.xz
- cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../..
- wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
- tar -xzf pcre2-10.30.tar.gz
- cd pcre2-10.30 && ./configure && make -j2 && sudo make install && cd ..
- pip install --user codecov && export CFLAGS="-coverage"
script:
- mkdir build && cd build && cmake .. && make -j2 && ctest --output-on-failure && cd -
after_success:
- bash <(curl -s https://codecov.io/bash)
- stage: Test
name: Linux with CLang ASAN and UBSAN
os: linux
compiler: clang
before_install:
- sudo apt-get update -qq && sudo apt-get install -y valgrind
- wget https://cmocka.org/files/1.1/cmocka-1.1.2.tar.xz
- tar -xf cmocka-1.1.2.tar.xz
- cd cmocka-1.1.2 && mkdir build && cd build && cmake .. && make -j2 && sudo make install && cd ../..
- wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
- tar -xzf pcre2-10.30.tar.gz
- cd pcre2-10.30 && ./configure && make -j2 && sudo -i -- sh -c 'cd /home/travis/build/CESNET/libyang/pcre2-10.30/ && make install' && cd ..
script:
- mkdir build && cd build && cmake -DCMAKE_C_FLAGS="-fsanitize=address,undefined" -DENABLE_VALGRIND_TESTS=OFF .. && make -j2 && ctest --output-on-failure && cd -
- stage: Test
name: ABI check
os: linux
compiled: gcc
before_install:
- sudo apt-get update -qq && sudo apt-get install -y abi-dumper abi-compliance-checker
- sudo snap install core universal-ctags
- wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
- tar -xzf pcre2-10.30.tar.gz
- cd pcre2-10.30 && ./configure && make -j2 && sudo make install && cd ..
script:
- mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=ABICheck .. && LC_ALL=C.UTF-8 PATH=/snap/bin:$PATH make abi-check && cd -
- stage: Test
name: OS X with GCC
os: osx
compiler: gcc
allow_failures:
- os: osx
script:
- mkdir build && cd build && cmake -DENABLE_VALGRIND_TESTS=OFF .. && make -j2 && ctest --output-on-failure && cd -