Skip to content

Commit 6463e0c

Browse files
committed
Add build scripts for Travis CI
1 parent 5f56429 commit 6463e0c

File tree

3 files changed

+54
-8
lines changed

3 files changed

+54
-8
lines changed

.travis.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ before_install:
1111
- sudo pip install cpp-coveralls --use-mirrors
1212

1313
script:
14-
- qmake CONFIG+=debug QMAKE_CXXFLAGS+="--coverage" QMAKE_LFLAGS+="--coverage"
15-
- make
16-
- export DISPLAY=:99.0
17-
- sh -e /etc/init.d/xvfb start
18-
- sleep 3
19-
- openbox &
20-
- ./copyq tests
14+
- utils/build.sh
2115

2216
after_success:
23-
- coveralls -e qxt -e src/platform -e src/tests -e /usr -e plugins/itemfakevim/fakevim -E '.*/moc_.*'
17+
- utils/after_build.sh

utils/after_build.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
# Generate coverage report for Coveralls after running tests with Travis CI.
3+
4+
# Exclude system and 3rd party files.
5+
exclude_files=(
6+
qxt
7+
src/tests
8+
/usr
9+
plugins/itemfakevim/fakevim
10+
)
11+
12+
# Exclude generated files.
13+
exclude_regexs=(
14+
'.*/moc_.*'
15+
'.*\.moc$'
16+
'.*/ui_.*'
17+
)
18+
19+
# Generate coverage report only with GCC.
20+
if [ "$CC" == "gcc" ]; then
21+
arguments=()
22+
23+
for file in "${exclude_files[@]}"; do
24+
arguments+=(--exclude "$file")
25+
done
26+
27+
for regex in "${exclude_regexs[@]}"; do
28+
arguments+=(--exclude-pattern "$regex")
29+
done
30+
31+
coveralls "${arguments[@]}"
32+
fi

utils/build.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# Build and run tests with Travis CI.
3+
4+
# Configure.
5+
if [ "$CC" == "gcc" ]; then
6+
# GCC build generates coverage.
7+
qmake CONFIG+=debug QMAKE_CXXFLAGS+=--coverage QMAKE_LFLAGS+=--coverage
8+
else
9+
qmake CONFIG+=debug
10+
fi
11+
12+
# Build.
13+
make
14+
15+
# Run tests.
16+
export DISPLAY=:99.0
17+
sh -e /etc/init.d/xvfb start
18+
sleep 3
19+
openbox &
20+
./copyq tests

0 commit comments

Comments
 (0)