Skip to content

Commit

Permalink
preliminary support for pr builds / 3rd party builds
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsar256 committed Jun 23, 2015
1 parent 5dee96c commit 91cb62b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
18 changes: 13 additions & 5 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ 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/cleanflight_${TARGET}
REPONAME=${TRAVIS_REPO_SLUG:=$USER/undefined}
BUILDNAME=${BUILDNAME:=travis}


# A hacky way of running the unit tests at the same time as the normal builds.
if [ $RUNTESTS ] ; then
Expand All @@ -14,12 +17,12 @@ elif [ $PUBLISHDOCS ] ; then
if [ $PUBLISH_URL ] ; then

sudo apt-get install zlib1g-dev libssl-dev wkhtmltopdf libxml2-dev libxslt-dev #ruby-rvm

# Patch Gimli to fix underscores_inside_words
curl -L 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 && rvmsudo gem install gimli
cd ../
Expand All @@ -32,6 +35,8 @@ elif [ $PUBLISHDOCS ] ; then
--form "branch=${BRANCH}" \
--form "last_commit_date=${LAST_COMMIT_DATE}" \
--form "travis_build_number=${TRAVIS_BUILD_NUMBER}" \
--form "github_repo=${REPONAME}" \
--form "build_name=${BUILDNAME}" \
${PUBLISH_URL}
fi

Expand All @@ -44,6 +49,8 @@ elif [ $PUBLISHMETA ] ; then
--form "branch=${BRANCH}" \
--form "last_commit_date=${LAST_COMMIT_DATE}" \
--form "travis_build_number=${TRAVIS_BUILD_NUMBER}" \
--form "github_repo=${REPONAME}" \
--form "build_name=${BUILDNAME}" \
${PUBLISH_URL}
fi

Expand All @@ -58,16 +65,17 @@ else
echo "build artifact (hex or bin) for ${TARGET_FILE} not found, aborting";
exit 1
fi

curl -k \
--form "file=@${TARGET_FILE}" \
--form "revision=${REVISION}" \
--form "branch=${BRANCH}" \
--form "last_commit_date=${LAST_COMMIT_DATE}" \
--form "travis_build_number=${TRAVIS_BUILD_NUMBER}" \
--form "github_repo=${REPONAME}" \
--form "build_name=${BUILDNAME}" \
${PUBLISH_URL}
else
make -j2
fi
fi

7 changes: 3 additions & 4 deletions fake_travis_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ targets=("PUBLISHMETA=True" "RUNTESTS=True" \
"TARGET=OLIMEXINO" "TARGET=PORT103R" "TARGET=SPARKY" "TARGET=STM32F3DISCOVERY" \
"TARGET=ALIENWIIF1" "TARGET=ALIENWIIF3")

#fake a travis build number
#fake a travis build environment
export TRAVIS_BUILD_NUMBER=$(date +%s)
export BUILDNAME=fake_travis
export TRAVIS_REPO_SLUG=$USER/simulated

for target in "${targets[@]}"
do
Expand All @@ -16,6 +18,3 @@ do
make clean
./.travis.sh
done



9 changes: 6 additions & 3 deletions support/buildserver/upload.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?
<?php
// see docs/Travis.md, .travis.sh

$baseDir = "/var/www/builds/";
Expand All @@ -12,8 +12,11 @@
$revision = sanitize($_POST["revision"]);
$branch = sanitize($_POST["branch"]);

$uploadDir = $baseDir . "/" . $lastCommitDate . "/";
$prefix = $uploadDir . $travisJobId . "_" . $revision;
$github_repo = sanitize($_POST["github_repo"]);
$build_name = sanitize($_POST["build_name"]);

$uploadDir = $baseDir . "/" . $github_repo . "/" . $lastCommitDate . "/";
$prefix = $uploadDir . $travisJobId . "_" . $revision . "_" . $build_name;

if(!file_exists($uploadDir)) mkdir($uploadDir, 0770, true);

Expand Down

0 comments on commit 91cb62b

Please sign in to comment.