Merge pull request #1928 from mikeller/fix_gcc_version_overriding
[betaflight.git] / .travis.sh
blob0d6a3cdc1a0aab0116eda43ad19383ae88e676d1
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/betaflight_${TARGET}
8 TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG:=$USER/undefined}
9 BUILDNAME=${BUILDNAME:=travis}
10 TRAVIS_BUILD_NUMBER=${TRAVIS_BUILD_NUMBER:=undefined}
12 CURL_BASEOPTS=(
13 "--retry" "10"
14 "--retry-max-time" "120" )
16 CURL_PUB_BASEOPTS=(
17 "--form" "revision=${REVISION}"
18 "--form" "branch=${BRANCH}"
19 "--form" "travis_build_number=${TRAVIS_BUILD_NUMBER}"
20 "--form" "last_commit_date=${LAST_COMMIT_DATE}"
21 "--form" "github_repo=${TRAVIS_REPO_SLUG}"
22 "--form" "build_name=${BUILDNAME}" )
24 # A hacky way of building the docs at the same time as the normal builds.
25 if [ $PUBLISHDOCS ] ; then
26 if [ $PUBLISH_URL ] ; then
28 # Patch Gimli to fix underscores_inside_words
29 curl -L "${CURL_BASEOPTS[@]}" https://github.com/walle/gimli/archive/v0.5.9.tar.gz | tar zxf -
31 sed -i 's/).render(/, :no_intra_emphasis => true).render(/' gimli-0.5.9/ext/github_markup.rb
33 cd gimli-0.5.9/
34 gem build gimli.gemspec && gem install gimli
35 cd ../
37 ./build_docs.sh
39 curl -k "${CURL_BASEOPTS[@]}" "${CURL_PUB_BASEOPTS[@]}" --form "manual=@docs/Manual.pdf" ${PUBLISH_URL} || true
42 elif [ $PUBLISHMETA ] ; then
43 if [ $PUBLISH_URL ] ; then
44 RECENT_COMMITS=$(git shortlog -n25)
45 curl -k "${CURL_BASEOPTS[@]}" "${CURL_PUB_BASEOPTS[@]}" --form "recent_commits=${RECENT_COMMITS}" ${PUBLISH_URL} || true
48 elif [ $TARGET ] ; then
49 make $TARGET
50 if [ $PUBLISH_URL ] ; then
51 if [ -f ${TARGET_FILE}.bin ] ; then
52 TARGET_FILE=${TARGET_FILE}.bin
53 elif [ -f ${TARGET_FILE}.hex ] ; then
54 TARGET_FILE=${TARGET_FILE}.hex
55 else
56 echo "build artifact (hex or bin) for ${TARGET_FILE} not found, aborting";
57 exit 1
60 curl -k "${CURL_BASEOPTS[@]}" "${CURL_PUB_BASEOPTS[@]}" --form "file=@${TARGET_FILE}" ${PUBLISH_URL} || true
61 exit 0;
63 elif [ $GOAL ] ; then
64 make V=0 $GOAL
65 else
66 make V=0 all