Commit 91cb62b2 authored by Paul Rogalinski's avatar Paul Rogalinski
Browse files

preliminary support for pr builds / 3rd party builds

parent 5dee96c3
......@@ -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
......@@ -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 ../
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -16,6 +18,3 @@ do
make clean
./.travis.sh
done
<?
<?php
// see docs/Travis.md, .travis.sh
$baseDir = "/var/www/builds/";
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment