forked from betaflight/betaflight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.sh
executable file
·81 lines (65 loc) · 2.51 KB
/
.travis.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
FC_VER=$(make version)
REVISION=$(git rev-parse --short HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
REVISION=$(git rev-parse --short HEAD)
LAST_COMMIT_DATE=$(git log -1 --date=short --format="%cd")
TARGET_FILE=obj/betaflight_${FC_VER}_${TARGET}
TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG:=$USER/undefined}
BUILDNAME=${BUILDNAME:=travis}
TRAVIS_BUILD_NUMBER=${TRAVIS_BUILD_NUMBER:=undefined}
MAKE="make EXTRA_FLAGS=-Werror V=0"
CURL_BASEOPTS=(
"--retry" "10"
"--retry-max-time" "120" )
CURL_PUB_BASEOPTS=(
"--form" "revision=${REVISION}"
"--form" "branch=${BRANCH}"
"--form" "travis_build_number=${TRAVIS_BUILD_NUMBER}"
"--form" "last_commit_date=${LAST_COMMIT_DATE}"
"--form" "github_repo=${TRAVIS_REPO_SLUG}"
"--form" "build_name=${BUILDNAME}" )
# A hacky way of building the docs at the same time as the normal builds.
if [ $PUBLISHDOCS ] ; then
if [ $PUBLISH_URL ] ; then
# Patch Gimli to fix underscores_inside_words
curl -L "${CURL_BASEOPTS[@]}" https://github.com/walle/gimli/archive/v0.5.9.tar.gz | tar zxf -
sed -i 's/).render(/, :no_intra_emphasis => true).render(/' gimli-0.5.9/ext/github_markup.rb
cd gimli-0.5.9/
gem build gimli.gemspec && gem install gimli
cd ../
./build_docs.sh
curl -k "${CURL_BASEOPTS[@]}" "${CURL_PUB_BASEOPTS[@]}" --form "manual=@docs/Manual.pdf" ${PUBLISH_URL} || true
fi
elif [ $PUBLISHMETA ] ; then
if [ $PUBLISH_URL ] ; then
RECENT_COMMITS=$(git shortlog -n25)
curl -k "${CURL_BASEOPTS[@]}" "${CURL_PUB_BASEOPTS[@]}" --form "recent_commits=${RECENT_COMMITS}" ${PUBLISH_URL} || true
fi
elif [ $TARGET ] ; then
$MAKE $TARGET || exit $?
if [ $PUBLISH_URL ] ; then
if [ -f ${TARGET_FILE}.bin ] ; then
TARGET_FILE=${TARGET_FILE}.bin
elif [ -f ${TARGET_FILE}.hex ] ; then
TARGET_FILE=${TARGET_FILE}.hex
else
echo "build artifact (hex or bin) for ${TARGET_FILE} not found, aborting";
exit 1
fi
curl -k "${CURL_BASEOPTS[@]}" "${CURL_PUB_BASEOPTS[@]}" --form "file=@${TARGET_FILE}" ${PUBLISH_URL} || true
exit 0;
fi
elif [ $GOAL ] ; then
$MAKE $GOAL || exit $?
if [ $PUBLISHCOV ] ; then
if [ "test" == "$GOAL" ] ; then
lcov --directory . -b src/test --capture --output-file coverage.info 2>&1 | grep -E ":version '402\*', prefer.*'406\*" --invert-match
lcov --remove coverage.info 'lib/test/*' 'src/test/*' '/usr/*' --output-file coverage.info # filter out system and test code
lcov --list coverage.info # debug before upload
coveralls-lcov coverage.info # uploads to coveralls
fi
fi
else
$MAKE all
fi