Spool up prevention without airmode
[betaflight.git] / .travis.sh
blobf848242d321e3e464f36846b84157b2c94e245b7
1 #!/bin/bash
3 REVISION=$(git rev-parse --short HEAD)
4 BRANCH=$(git rev-parse --abbrev-ref HEAD)
5 REVISION=$(git rev-parse --short HEAD)
6 LAST_COMMIT_DATE=$(git log -1 --date=short --format="%cd")
7 TARGET_FILE=obj/cleanflight_${TARGET}
8 TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG:=$USER/undefined}
9 BUILDNAME=${BUILDNAME:=travis}
10 TRAVIS_BUILD_NUMBER=${TRAVIS_BUILD_NUMBER:=undefined}
11 MAKEFILE="-f Makefile"
13 CURL_BASEOPTS=(
14 "--retry" "10"
15 "--retry-max-time" "120" )
17 CURL_PUB_BASEOPTS=(
18 "--form" "revision=${REVISION}"
19 "--form" "branch=${BRANCH}"
20 "--form" "travis_build_number=${TRAVIS_BUILD_NUMBER}"
21 "--form" "last_commit_date=${LAST_COMMIT_DATE}"
22 "--form" "github_repo=${TRAVIS_REPO_SLUG}"
23 "--form" "build_name=${BUILDNAME}" )
25 # A hacky way of running the unit tests at the same time as the normal builds.
26 if [ $RUNTESTS ] ; then
27 cd ./src/test && make test
29 # A hacky way of building the docs at the same time as the normal builds.
30 elif [ $PUBLISHDOCS ] ; then
31 if [ $PUBLISH_URL ] ; then
33 # Patch Gimli to fix underscores_inside_words
34 curl -L "${CURL_BASEOPTS[@]}" https://github.com/walle/gimli/archive/v0.5.9.tar.gz | tar zxf -
36 sed -i 's/).render(/, :no_intra_emphasis => true).render(/' gimli-0.5.9/ext/github_markup.rb
38 cd gimli-0.5.9/
39 gem build gimli.gemspec && gem install gimli
40 cd ../
42 ./build_docs.sh
44 curl -k "${CURL_BASEOPTS[@]}" "${CURL_PUB_BASEOPTS[@]}" --form "manual=@docs/Manual.pdf" ${PUBLISH_URL} || true
47 elif [ $PUBLISHMETA ] ; then
48 if [ $PUBLISH_URL ] ; then
49 RECENT_COMMITS=$(git shortlog -n25)
50 curl -k "${CURL_BASEOPTS[@]}" "${CURL_PUB_BASEOPTS[@]}" --form "recent_commits=${RECENT_COMMITS}" ${PUBLISH_URL} || true
53 else
54 if [ $PUBLISH_URL ] ; then
55 make -j2 $MAKEFILE
56 if [ -f ${TARGET_FILE}.bin ] ; then
57 TARGET_FILE=${TARGET_FILE}.bin
58 elif [ -f ${TARGET_FILE}.hex ] ; then
59 TARGET_FILE=${TARGET_FILE}.hex
60 else
61 echo "build artifact (hex or bin) for ${TARGET_FILE} not found, aborting";
62 exit 1
65 curl -k "${CURL_BASEOPTS[@]}" "${CURL_PUB_BASEOPTS[@]}" --form "file=@${TARGET_FILE}" ${PUBLISH_URL} || true
66 exit 0;
67 else
68 make -j2 $MAKEFILE