Codebase list facter / 10fe983
(maint) Simplify Travis scripts Separates Doxygen generation as its own step, and simplifies the script based on puppetlabs/cpp-project-template. Only installs files that are necessary for the particular build task being performed. Michael Smith 8 years ago
2 changed file(s) with 46 addition(s) and 87 deletion(s). Raw diff Collapse all Expand all
2020 - libblkid1
2121
2222 before_install:
23
2423 # Use a predefined install location; cppcheck requires the cfg location is defined at compile-time.
2524 - mkdir -p $USERDIR
2625 # grab a pre-built cmake 3.2.3
2726 - wget http://www.cmake.org/files/v3.2/cmake-3.2.3-Linux-x86_64.tar.gz
2827 - tar xzvf cmake-3.2.3-Linux-x86_64.tar.gz --strip 1 -C $USERDIR
29 # grab a pre-built cppcheck from s3
30 - wget https://s3.amazonaws.com/kylo-pl-bucket/pcre-8.36_install.tar.bz2
31 - tar xjvf pcre-8.36_install.tar.bz2 --strip 1 -C $USERDIR
32 - wget https://s3.amazonaws.com/kylo-pl-bucket/cppcheck-1.69_install.tar.bz2
33 - tar xjvf cppcheck-1.69_install.tar.bz2 --strip 1 -C $USERDIR
34 # grab a pre-built doxygen 1.8.10
35 - wget https://s3.amazonaws.com/kylo-pl-bucket/doxygen-1.8.10.linux.bin.tar.gz
36 - tar xzvf doxygen-1.8.10.linux.bin.tar.gz --strip 1 -C $USERDIR
3728 # Install dependencies of facter
3829 - wget https://s3.amazonaws.com/kylo-pl-bucket/yaml-cpp-0.5.1_install.tar.bz2
3930 - tar xjvf yaml-cpp-0.5.1_install.tar.bz2 --strip 1 -C $USERDIR
40 # Install coveralls.io update utility
41 - pip install --user cpp-coveralls
4231
4332 script: ./scripts/travis_target.sh
4433
4938 - PATH=$USERDIR/bin:$PATH
5039 - LD_LIBRARY_PATH=$USERDIR/lib:$LD_LIBRARY_PATH
5140 matrix:
41 - TRAVIS_TARGET=DOXYGEN
5242 - TRAVIS_TARGET=CPPLINT
5343 - TRAVIS_TARGET=CPPCHECK
5444 - TRAVIS_TARGET=RELEASE
0 #! /bin/bash
0 #!/bin/bash
1 set -ev
12
2 # Travis cpp jobs construct a matrix based on environment variables
3 # (and the value of 'compiler'). In order to test multiple builds
4 # (release/debug/cpplint/cppcheck), this uses a TRAVIS_TARGET env
5 # var to do the right thing.
3 # Set compiler to GCC 4.8 here, as Travis overrides the global variables.
4 export CC=gcc-4.8 CXX=g++-4.8
65
7 function travis_make()
8 {
9 mkdir $1 && cd $1
6 if [ ${TRAVIS_TARGET} == CPPCHECK ]; then
7 # grab a pre-built cppcheck from s3
8 wget https://s3.amazonaws.com/kylo-pl-bucket/pcre-8.36_install.tar.bz2
9 tar xjvf pcre-8.36_install.tar.bz2 --strip 1 -C $USERDIR
10 wget https://s3.amazonaws.com/kylo-pl-bucket/cppcheck-1.69_install.tar.bz2
11 tar xjvf cppcheck-1.69_install.tar.bz2 --strip 1 -C $USERDIR
12 elif [ ${TRAVIS_TARGET} == DOXYGEN ]; then
13 # grab a pre-built doxygen 1.8.7 from s3
14 wget https://s3.amazonaws.com/kylo-pl-bucket/doxygen_install.tar.bz2
15 tar xjvf doxygen_install.tar.bz2 --strip 1 -C $USERDIR
16 elif [ ${TRAVIS_TARGET} == DEBUG ]; then
17 # Install coveralls.io update utility
18 pip install --user cpp-coveralls
19 fi
1020
11 # Set compiler to GCC 4.8 here, as Travis overrides the global variables.
12 export CC=gcc-4.8 CXX=g++-4.8
13 # Generate build files
14 [ $1 == "debug" ] && export CMAKE_VARS="-DCMAKE_BUILD_TYPE=Debug -DCOVERALLS=ON"
15 cmake $CMAKE_VARS ..
16 if [ $? -ne 0 ]; then
17 echo "cmake failed."
18 exit 1
19 fi
21 # Generate build files
22 if [ ${TRAVIS_TARGET} == DEBUG ]; then
23 cmake -DCMAKE_BUILD_TYPE=Debug -DCOVERALLS=ON .
24 else
25 cmake .
26 fi
2027
21 # Build facter
22 if [ $1 == "cpplint" ]; then
23 export MAKE_TARGET="cpplint"
24 elif [ $1 == "cppcheck" ]; then
25 export MAKE_TARGET="cppcheck"
26 else
27 export MAKE_TARGET="all"
28 fi
29 make $MAKE_TARGET -j2
30 if [ $? -ne 0 ]; then
31 echo "build failed."
32 exit 1
33 fi
28 if [ ${TRAVIS_TARGET} == CPPLINT ]; then
29 make cpplint
30 elif [ ${TRAVIS_TARGET} == DOXYGEN ]; then
31 # Build docs
32 pushd lib
33 doxygen 2>&1 | ( ! grep . )
34 ruby docs/generate.rb > /tmp/facts.md
35 popd
36 elif [ ${TRAVIS_TARGET} == CPPCHECK ]; then
37 make cppcheck
38 else
39 make -j2
3440
35 # Run tests if not doing cpplint/cppcheck
36 if [ $1 == "cpplint" ]; then
37 # Verify documentation
38 pushd ../lib
39 doxygen 2>&1 | ( ! grep . )
40 if [ $? -ne 0 ]; then
41 echo "documentation failed."
42 exit 1
43 fi
44 ruby docs/generate.rb > /tmp/facts.md
45 if [ $? -ne 0 ]; then
46 echo "fact documentation failed."
47 exit 1
48 fi
49 popd
50 elif [ $1 != "cppcheck" ]; then
51 # Install the bundle before testing
52 bundle install --gemfile=../lib/Gemfile
53 if [ $? -ne 0 ]; then
54 echo "bundle install failed."
55 exit 1
56 fi
41 # Install the bundle before testing
42 bundle install --gemfile=lib/Gemfile
43 make test ARGS=-V
5744
58 LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so ctest -V 2>&1 | c++filt
59 if [ ${PIPESTATUS[0]} -ne 0 ]; then
60 echo "tests reported an error."
61 exit 1
62 fi
45 # Make sure installation succeeds
46 make DESTDIR=$USERDIR install
6347
64 if [ $1 == "debug" ]; then
65 coveralls --gcov gcov-4.8 --gcov-options '\-lp' -r .. >/dev/null
66 fi
48 if [ ${TRAVIS_TARGET} == DEBUG ]; then
49 coveralls --gcov gcov-4.8 --gcov-options '\-lp' -r .. >/dev/null
50 fi
51 fi
6752
68 # Make sure installation succeeds
69 make DESTDIR=$USERDIR install
70 if [ $? -ne 0 ]; then
71 echo "install failed."
72 exit 1
73 fi
74 fi
75 }
76
77 case $TRAVIS_TARGET in
78 "CPPLINT" ) travis_make cpplint ;;
79 "CPPCHECK" ) travis_make cppcheck ;;
80 "RELEASE" ) travis_make release ;;
81 "DEBUG" ) travis_make debug ;;
82 *) echo "Nothing to do!"
83 esac