Skip to content

Commit 1309d94

Browse files
committed
Improve Travis Continuous Integration script
- Use more explicit matrix - Fix issue with clang 3.5+ - Add more compiler variations - Fix coverage on mac (path issue) - Speed up coverage builds a bit (O1) - Error out correctly on plugin tests
1 parent 19cea72 commit 1309d94

12 files changed

+86
-40
lines changed

.travis.yml

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
language: cpp
22
sudo: false
33

4-
os:
5-
- linux
6-
- osx
7-
8-
compiler:
9-
- gcc
10-
- clang
114

125
# don't create redundant code coverage reports
136
# - AUTOTOOLS=yes COVERAGE=yes BUILD=static
@@ -19,25 +12,46 @@ compiler:
1912
# this will still catch all coding errors!
2013
# - AUTOTOOLS=yes COVERAGE=no BUILD=static
2114

22-
env:
23-
- AUTOTOOLS=no COVERAGE=no BUILD=shared
24-
- AUTOTOOLS=no COVERAGE=yes BUILD=static
25-
- AUTOTOOLS=yes COVERAGE=no BUILD=shared
26-
2715
# currenty there are various issues when
2816
# built with coverage, clang and autotools
2917
# - AUTOTOOLS=yes COVERAGE=yes BUILD=shared
3018

3119
matrix:
32-
exclude:
33-
- compiler: clang
34-
env: AUTOTOOLS=yes COVERAGE=yes BUILD=static
20+
include :
21+
- os: linux
22+
compiler: gcc
23+
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
3524
- os: linux
25+
compiler: g++-5
26+
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
27+
addons:
28+
apt:
29+
sources:
30+
- ubuntu-toolchain-r-test
31+
packages:
32+
- g++-5
33+
- os: linux
34+
compiler: clang++-3.7
35+
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
36+
addons:
37+
apt:
38+
sources:
39+
- ubuntu-toolchain-r-test
40+
- llvm-toolchain-precise-3.7
41+
packages:
42+
- clang-3.7
43+
- os: linux
44+
compiler: clang
45+
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
46+
- os: osx
47+
compiler: clang
3648
env: AUTOTOOLS=no COVERAGE=no BUILD=shared
3749
- os: osx
38-
compiler: gcc
50+
compiler: clang
51+
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
3952
- os: osx
40-
env: AUTOTOOLS=no BUILD=static
53+
compiler: clang
54+
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
4155

4256
script:
4357
- ./script/ci-build-libsass

GNUmakefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ AM_COPT = -Wall -O2
44
AM_COVLDFLAGS =
55

66
if ENABLE_COVERAGE
7-
AM_COPT = -O0 --coverage
7+
AM_COPT = -Wall -O1 -fno-omit-frame-pointer --coverage
88
AM_COVLDFLAGS += -lgcov
99
endif
1010

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ INSTALL ?= install
1515
CFLAGS ?= -Wall
1616
CXXFLAGS ?= -Wall
1717
LDFLAGS ?= -Wall
18-
ifneq "$(COVERAGE)" "yes"
18+
ifeq "x$(COVERAGE)" "x"
1919
CFLAGS += -O2
2020
CXXFLAGS += -O2
2121
LDFLAGS += -O2
22+
else
23+
CFLAGS += -O1 -fno-omit-frame-pointer
24+
CXXFLAGS += -O1 -fno-omit-frame-pointer
25+
LDFLAGS += -O1 -fno-omit-frame-pointer
2226
endif
2327
LDFLAGS += -Wl,-undefined,error
2428
CAT ?= $(if $(filter $(OS),Windows_NT),type,cat)

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ if test "x$enable_cov" = "xyes"; then
121121

122122
# Remove all optimization flags from C[XX]FLAGS
123123
changequote({,})
124-
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
125-
CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9]*//g'`
124+
CFLAGS=`echo "$CFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'`
125+
CXXFLAGS=`echo "$CXXFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'`
126126
changequote([,])
127127

128128
AC_SUBST(GCOV)

script/ci-build-libsass

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ if [ "x$TRAVIS_OS_NAME" == "x" ]; then export TRAVIS_OS_NAME=`uname -s | perl -n
1818

1919
if [ "x$COVERAGE" == "xyes" ]; then
2020
COVERAGE_OPT="--enable-coverage"
21-
export EXTRA_CFLAGS="--coverage"
22-
export EXTRA_CXXFLAGS="--coverage"
23-
export EXTRA_LDFLAGS="--coverage"
21+
export EXTRA_CFLAGS="-fprofile-arcs -ftest-coverage"
22+
export EXTRA_CXXFLAGS="-fprofile-arcs -ftest-coverage"
23+
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
24+
# osx doesn't seem to know gcov lib?
25+
export EXTRA_LDFLAGS="--coverage"
26+
else
27+
export EXTRA_LDFLAGS="-lgcov --coverage"
28+
fi
2429
else
2530
COVERAGE_OPT="--disable-coverage"
2631
fi

script/ci-build-plugin

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,33 @@ if [ "x$1" == "x" ] ; then
1919
exit 1
2020
fi
2121

22+
if [ "x$COVERAGE" == "0" ] ; then
23+
unset COVERAGE
24+
fi
25+
26+
export EXTRA_CFLAGS=""
27+
export EXTRA_CXXFLAGS=""
28+
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
29+
# osx doesn't seem to know gcov lib?
30+
export EXTRA_LDFLAGS="--coverage"
31+
else
32+
export EXTRA_LDFLAGS="-lgcov --coverage"
33+
fi
34+
2235
mkdir -p plugins
2336
if [ ! -d plugins/libsass-${PLUGIN} ] ; then
2437
git clone https://github.com/mgreter/libsass-${PLUGIN} plugins/libsass-${PLUGIN}
2538
fi
2639
if [ ! -d plugins/libsass-${PLUGIN}/build ] ; then
2740
mkdir plugins/libsass-${PLUGIN}/build
2841
fi
42+
RETVAL=$?; if [ "$RETVAL" != "0" ]; then exit $RETVAL; fi
2943

3044
cd plugins/libsass-${PLUGIN}/build
3145
cmake -G "Unix Makefiles" -D LIBSASS_DIR="../../.." ..
32-
make -j2
46+
RETVAL=$?; if [ "$RETVAL" != "0" ]; then exit $RETVAL; fi
47+
make VERBOSE=1 -j2
48+
RETVAL=$?; if [ "$RETVAL" != "0" ]; then exit $RETVAL; fi
3349
cd ../../..
3450

3551
# glob only works on paths relative to imports
@@ -40,5 +56,7 @@ else
4056
cat ${SASS_SPEC_SPEC_DIR}/basic/input.scss | ${SASSC_BIN} --plugin-path plugins/libsass-${PLUGIN}/build -I ${SASS_SPEC_SPEC_DIR}/basic > ${SASS_SPEC_SPEC_DIR}/basic/result.css
4157
cat ${SASS_SPEC_SPEC_DIR}/basic/input.scss | ${SASSC_BIN} --plugin-path plugins/libsass-${PLUGIN}/build -I ${SASS_SPEC_SPEC_DIR}/basic --sourcemap > /dev/null
4258
fi
59+
RETVAL=$?; if [ "$RETVAL" != "0" ]; then exit $RETVAL; fi
4360

4461
diff ${SASS_SPEC_SPEC_DIR}/basic/expected_output.css ${SASS_SPEC_SPEC_DIR}/basic/result.css
62+
RETVAL=$?; if [ "$RETVAL" != "0" ]; then exit $RETVAL; fi

script/ci-report-coverage

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
if [ "x$COVERAGE" = "xyes" ]; then
44

5+
# find / -name "gcovr"
6+
# find / -name "coveralls"
7+
# this is only needed for mac os x builds!
8+
PATH=$PATH:/Users/travis/Library/Python/2.7/bin/
9+
10+
511
# exclude some directories from profiling (.libs is from autotools)
612
export EXCLUDE_COVERAGE="--exclude plugins
713
--exclude sassc/sassc.c
@@ -21,10 +27,14 @@ if [ "x$COVERAGE" = "xyes" ]; then
2127
--exclude src/test
2228
--exclude src/posix
2329
--exclude src/debugger.hpp"
24-
# debug via gcovr
25-
gcov -v
30+
# debug used gcov version
31+
# option not available on mac
32+
if [ "$TRAVIS_OS_NAME" != "osx" ]; then
33+
gcov -v
34+
fi
35+
# create summarized report
2636
gcovr -r .
27-
# generate and submit report to coveralls.io
37+
# submit report to coveralls.io
2838
coveralls $EXCLUDE_COVERAGE --gcov-options '\-lp'
2939

3040
else

src/color_maps.hpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
#ifndef SASS_COLOR_MAPS_H
23
#define SASS_COLOR_MAPS_H
34

@@ -319,14 +320,11 @@ namespace Sass {
319320
extern const Color transparent;
320321
}
321322

322-
extern const std::map<const int, const char*> colors_to_names;
323-
extern const std::map<const char*, Color_Ptr_Const, map_cmp_str> names_to_colors;
324-
325-
extern Color_Ptr_Const name_to_color(const char*);
326-
extern Color_Ptr_Const name_to_color(const std::string&);
327-
extern const char* color_to_name(const int);
328-
extern const char* color_to_name(const Color&);
329-
extern const char* color_to_name(const double);
323+
Color_Ptr_Const name_to_color(const char*);
324+
Color_Ptr_Const name_to_color(const std::string&);
325+
const char* color_to_name(const int);
326+
const char* color_to_name(const Color&);
327+
const char* color_to_name(const double);
330328

331329
}
332330

src/lexer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "sass.hpp"
22
#include <cctype>
3-
#include <cstddef>
43
#include <iostream>
54
#include <iomanip>
65
#include "lexer.hpp"

src/prelexer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "sass.hpp"
22
#include <cctype>
3-
#include <cstddef>
43
#include <iostream>
54
#include <iomanip>
65
#include "util.hpp"

0 commit comments

Comments
 (0)