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